summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindow.java55
-rw-r--r--policy/src/com/android/internal/policy/impl/PhoneWindowManager.java5
2 files changed, 59 insertions, 1 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
index 6b28e8e..085134d 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java
@@ -139,6 +139,12 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
private ActionMenuPresenterCallback mActionMenuPresenterCallback;
private PanelMenuPresenterCallback mPanelMenuPresenterCallback;
+ static final int FLAG_RESOURCE_SET_ICON = 1 << 0;
+ static final int FLAG_RESOURCE_SET_LOGO = 1 << 1;
+ int mResourcesSetFlags;
+ int mIconRes;
+ int mLogoRes;
+
private DrawableFeatureState[] mDrawables;
private PanelFeatureState[] mPanels;
@@ -1393,6 +1399,46 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
}
}
+ @Override
+ public void setIcon(int resId) {
+ mIconRes = resId;
+ mResourcesSetFlags |= FLAG_RESOURCE_SET_ICON;
+ if (mActionBar != null) {
+ mActionBar.setIcon(resId);
+ }
+ }
+
+ @Override
+ public void setDefaultIcon(int resId) {
+ if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0) {
+ return;
+ }
+ mIconRes = resId;
+ if (mActionBar != null && !mActionBar.hasIcon()) {
+ mActionBar.setIcon(resId);
+ }
+ }
+
+ @Override
+ public void setLogo(int resId) {
+ mLogoRes = resId;
+ mResourcesSetFlags |= FLAG_RESOURCE_SET_LOGO;
+ if (mActionBar != null) {
+ mActionBar.setLogo(resId);
+ }
+ }
+
+ @Override
+ public void setDefaultLogo(int resId) {
+ if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0) {
+ return;
+ }
+ mLogoRes = resId;
+ if (mActionBar != null && !mActionBar.hasLogo()) {
+ mActionBar.setLogo(resId);
+ }
+ }
+
/**
* Request that key events come to this activity. Use this if your activity
* has no views with focus, but the activity still wants a chance to process
@@ -2946,6 +2992,15 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
"incompatible window decor! Ignoring request.");
}
+ if ((mResourcesSetFlags & FLAG_RESOURCE_SET_ICON) != 0 ||
+ (mIconRes != 0 && !mActionBar.hasIcon())) {
+ mActionBar.setIcon(mIconRes);
+ }
+ if ((mResourcesSetFlags & FLAG_RESOURCE_SET_LOGO) != 0 ||
+ (mLogoRes != 0 && !mActionBar.hasLogo())) {
+ mActionBar.setLogo(mLogoRes);
+ }
+
// Post the panel invalidate for later; avoid application onCreateOptionsMenu
// being called in the middle of onCreate or similar.
mDecor.post(new Runnable() {
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 79753a6..b8a9797 100644
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1582,7 +1582,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
@Override
public View addStartingWindow(IBinder appToken, String packageName, int theme,
CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
- int icon, int windowFlags) {
+ int icon, int logo, int windowFlags) {
if (!SHOW_STARTING_ANIMATIONS) {
return null;
}
@@ -1639,6 +1639,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
win.addFlags(WindowManager.LayoutParams.FLAG_COMPATIBLE_WINDOW);
}
+ win.setDefaultIcon(icon);
+ win.setDefaultLogo(logo);
+
win.setLayout(WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.MATCH_PARENT);