Merge changes Iccd4d53d,Id449bc7a into lmp-dev
* changes:
camera2: Avoid setting null metering regions in LEGACY.
camera2: Fix JPEG orientation set by LEGACY request.
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index fb44e58..91e5330 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -1316,6 +1316,11 @@
mHomeLayout.setUpIndicator(indicator);
}
+ @Override
+ public void setDefaultNavigationIcon(Drawable icon) {
+ mHomeLayout.setDefaultUpIndicator(icon);
+ }
+
public void setNavigationIcon(int resId) {
mHomeLayout.setUpIndicator(resId);
}
@@ -1380,6 +1385,7 @@
private int mStartOffset;
private int mUpIndicatorRes;
private Drawable mDefaultUpIndicator;
+ private Drawable mUpIndicator;
private static final long DEFAULT_TRANSITION_DURATION = 150;
@@ -1409,13 +1415,30 @@
}
public void setUpIndicator(Drawable d) {
- mUpView.setImageDrawable(d != null ? d : mDefaultUpIndicator);
+ mUpIndicator = d;
mUpIndicatorRes = 0;
+ updateUpIndicator();
+ }
+
+ public void setDefaultUpIndicator(Drawable d) {
+ mDefaultUpIndicator = d;
+ updateUpIndicator();
}
public void setUpIndicator(int resId) {
mUpIndicatorRes = resId;
- mUpView.setImageDrawable(resId != 0 ? getContext().getDrawable(resId) : null);
+ mUpIndicator = null;
+ updateUpIndicator();
+ }
+
+ private void updateUpIndicator() {
+ if (mUpIndicator != null) {
+ mUpView.setImageDrawable(mUpIndicator);
+ } else if (mUpIndicatorRes != 0) {
+ mUpView.setImageDrawable(getContext().getDrawable(mUpIndicatorRes));
+ } else {
+ mUpView.setImageDrawable(mDefaultUpIndicator);
+ }
}
@Override
@@ -1423,7 +1446,7 @@
super.onConfigurationChanged(newConfig);
if (mUpIndicatorRes != 0) {
// Reload for config change
- setUpIndicator(mUpIndicatorRes);
+ updateUpIndicator();
}
}
diff --git a/core/java/com/android/internal/widget/DecorToolbar.java b/core/java/com/android/internal/widget/DecorToolbar.java
index fee3015..f89f0b7 100644
--- a/core/java/com/android/internal/widget/DecorToolbar.java
+++ b/core/java/com/android/internal/widget/DecorToolbar.java
@@ -90,6 +90,7 @@
void setNavigationContentDescription(CharSequence description);
void setNavigationContentDescription(int resId);
void setDefaultNavigationContentDescription(int defaultNavigationContentDescription);
+ void setDefaultNavigationIcon(Drawable icon);
void saveHierarchyState(SparseArray<Parcelable> toolbarStates);
void restoreHierarchyState(SparseArray<Parcelable> toolbarStates);
}
diff --git a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java
index 478c8f2..324a6c9 100644
--- a/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java
+++ b/core/java/com/android/internal/widget/ToolbarWidgetWrapper.java
@@ -84,6 +84,7 @@
private int mNavigationMode = ActionBar.NAVIGATION_MODE_STANDARD;
private int mDefaultNavigationContentDescription = 0;
+ private Drawable mDefaultNavigationIcon;
public ToolbarWidgetWrapper(Toolbar toolbar, boolean style) {
this(toolbar, style, R.string.action_bar_up_description);
@@ -96,11 +97,10 @@
mTitle = toolbar.getTitle();
mSubtitle = toolbar.getSubtitle();
mTitleSet = mTitle != null;
-
+ final TypedArray a = toolbar.getContext().obtainStyledAttributes(null,
+ R.styleable.ActionBar, R.attr.actionBarStyle, 0);
+ mDefaultNavigationIcon = a.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
if (style) {
- final TypedArray a = toolbar.getContext().obtainStyledAttributes(null,
- R.styleable.ActionBar, R.attr.actionBarStyle, 0);
-
final CharSequence title = a.getText(R.styleable.ActionBar_title);
if (!TextUtils.isEmpty(title)) {
setTitle(title);
@@ -120,12 +120,9 @@
if (icon != null) {
setIcon(icon);
}
-
- final Drawable navIcon = a.getDrawable(R.styleable.ActionBar_homeAsUpIndicator);
- if (navIcon != null) {
- setNavigationIcon(navIcon);
+ if (mDefaultNavigationIcon != null) {
+ setNavigationIcon(mDefaultNavigationIcon);
}
-
setDisplayOptions(a.getInt(R.styleable.ActionBar_displayOptions, 0));
final int customNavId = a.getResourceId(
@@ -167,11 +164,10 @@
if (popupTheme != 0) {
mToolbar.setPopupTheme(popupTheme);
}
-
- a.recycle();
} else {
mDisplayOpts = detectDisplayOptions();
}
+ a.recycle();
setDefaultNavigationContentDescription(defaultNavigationContentDescription);
mHomeDescription = mToolbar.getNavigationContentDescription();
@@ -204,6 +200,7 @@
ActionBar.DISPLAY_USE_LOGO;
if (mToolbar.getNavigationIcon() != null) {
opts |= ActionBar.DISPLAY_HOME_AS_UP;
+ mDefaultNavigationIcon = mToolbar.getNavigationIcon();
}
return opts;
}
@@ -410,11 +407,9 @@
if (changed != 0) {
if ((changed & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
if ((newOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
- mToolbar.setNavigationIcon(mNavIcon);
updateHomeAccessibility();
- } else {
- mToolbar.setNavigationIcon(null);
}
+ updateNavigationIcon();
}
if ((changed & AFFECTS_LOGO_MASK) != 0) {
@@ -607,9 +602,7 @@
@Override
public void setNavigationIcon(Drawable icon) {
mNavIcon = icon;
- if ((mDisplayOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
- mToolbar.setNavigationIcon(icon);
- }
+ updateNavigationIcon();
}
@Override
@@ -618,6 +611,22 @@
}
@Override
+ public void setDefaultNavigationIcon(Drawable defaultNavigationIcon) {
+ if (mDefaultNavigationIcon != defaultNavigationIcon) {
+ mDefaultNavigationIcon = defaultNavigationIcon;
+ updateNavigationIcon();
+ }
+ }
+
+ private void updateNavigationIcon() {
+ if ((mDisplayOpts & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
+ mToolbar.setNavigationIcon(mNavIcon != null ? mNavIcon : mDefaultNavigationIcon);
+ } else {
+ mToolbar.setNavigationIcon(null);
+ }
+ }
+
+ @Override
public void setNavigationContentDescription(CharSequence description) {
mHomeDescription = description;
updateHomeAccessibility();
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index c04ca83..80e9663 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -1738,6 +1738,10 @@
updateKeyguardStatusBarVisibility();
}
+ public boolean isDozing() {
+ return mDozing;
+ }
+
private static void setBackgroundColorAlpha(final View target, int rgb, int targetAlpha,
boolean animate) {
int currentAlpha = getBackgroundAlpha(target);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 9d77331..90f9cdd 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -3641,7 +3641,7 @@
}
private void updateDozingState() {
- if (mState != StatusBarState.KEYGUARD) {
+ if (mState != StatusBarState.KEYGUARD && !mNotificationPanel.isDozing()) {
return;
}
mNotificationPanel.setDozing(mDozing);