summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2013-06-13 13:15:43 -0700
committerAdam Powell <adamp@google.com>2013-06-13 13:15:43 -0700
commit0a317e91168aecd53062a78173b307dfa9a8f517 (patch)
treeef485077284ca8576a0a91d6b9a4b5840de71c6f /policy
parent6fbb5553a5b2d7c19ea411ace9a46e18262698c4 (diff)
downloadframeworks_base-0a317e91168aecd53062a78173b307dfa9a8f517.zip
frameworks_base-0a317e91168aecd53062a78173b307dfa9a8f517.tar.gz
frameworks_base-0a317e91168aecd53062a78173b307dfa9a8f517.tar.bz2
Show the default activity icon in the action bar if one is not supplied
Fix a regression where the system default activity icon was not used in the action bar if neither the activity nor application supplied one. Bug 9409846 Change-Id: I80a95a0bee511f21cd326372edaf6af811272825
Diffstat (limited to 'policy')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 085134d..a21b089 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -139,8 +139,18 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private ActionMenuPresenterCallback mActionMenuPresenterCallback;
private PanelMenuPresenterCallback mPanelMenuPresenterCallback;
+ // The icon resource has been explicitly set elsewhere
+ // and should not be overwritten with a default.
static final int FLAG_RESOURCE_SET_ICON = 1 << 0;
+
+ // The logo resource has been explicitly set elsewhere
+ // and should not be overwritten with a default.
static final int FLAG_RESOURCE_SET_LOGO = 1 << 1;
+
+ // The icon resource is currently configured to use the system fallback
+ // as no default was previously specified. Anything can override this.
+ static final int FLAG_RESOURCE_SET_ICON_FALLBACK = 1 << 2;
+
int mResourcesSetFlags;
int mIconRes;
int mLogoRes;
@@ -1403,6 +1413,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
public void setIcon(int resId) {
mIconRes = resId;
mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON;
+ mResourcesSetFlags &= ~FLAG_RESOURCE_SET_ICON_FALLBACK;
if (mActionBar != null) {
mActionBar.setIcon(resId);
}
@@ -1414,8 +1425,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
return;
}
mIconRes = resId;
- if (mActionBar != null && !mActionBar.hasIcon()) {
- mActionBar.setIcon(resId);
+ if (mActionBar != null && (!mActionBar.hasIcon() ||
+ (mResourcesSetFlags & FLAG_RESOURCE_SET_ICON_FALLBACK) != 0)) {
+ if (resId != 0) {
+ mActionBar.setIcon(resId);
+ mResourcesSetFlags &= ~FLAG_RESOURCE_SET_ICON_FALLBACK;
+ } else {
+ mActionBar.setIcon(getContext().getPackageManager().getDefaultActivityIcon());
+ mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON_FALLBACK;
+ }
}
}
@@ -2995,6 +3013,11 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0 ||
(mIconRes != 0 && !mActionBar.hasIcon())) {
mActionBar.setIcon(mIconRes);
+ } else if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) == 0 &&
+ mIconRes == 0 && !mActionBar.hasIcon()) {
+ mActionBar.setIcon(
+ getContext().getPackageManager().getDefaultActivityIcon());
+ mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON_FALLBACK;
}
if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0 ||
(mLogoRes != 0 && !mActionBar.hasLogo())) {