diff options
48 files changed, 558 insertions, 265 deletions
diff --git a/api/current.xml b/api/current.xml index ebfcdaf..bd59694 100644 --- a/api/current.xml +++ b/api/current.xml @@ -1885,6 +1885,28 @@ visibility="public" > </field> +<field name="actionMenuTextAppearance" + type="int" + transient="false" + volatile="false" + value="16843616" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="actionMenuTextColor" + type="int" + transient="false" + volatile="false" + value="16843617" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> <field name="actionModeBackground" type="int" transient="false" @@ -94279,6 +94301,17 @@ visibility="public" > </constructor> +<method name="getBackDisposition" + return="int" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +</method> <method name="getCandidatesHiddenVisibility" return="int" abstract="false" @@ -95004,6 +95037,19 @@ <parameter name="charCode" type="char"> </parameter> </method> +<method name="setBackDisposition" + return="void" + abstract="false" + native="false" + synchronized="false" + static="false" + final="false" + deprecated="not deprecated" + visibility="public" +> +<parameter name="disposition" type="int"> +</parameter> +</method> <method name="setCandidatesView" return="void" abstract="false" @@ -95130,6 +95176,39 @@ visibility="public" > </method> +<field name="BACK_DISPOSITION_DEFAULT" + type="int" + transient="false" + volatile="false" + value="0" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="BACK_DISPOSITION_WILL_DISMISS" + type="int" + transient="false" + volatile="false" + value="2" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> +<field name="BACK_DISPOSITION_WILL_NOT_DISMISS" + type="int" + transient="false" + volatile="false" + value="1" + static="true" + final="true" + deprecated="not deprecated" + visibility="public" +> +</field> </class> <class name="InputMethodService.InputMethodImpl" extends="android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl" diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 055984f..3c45080 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -4268,7 +4268,7 @@ public class Activity extends ContextThemeWrapper mWindow = PolicyManager.makeNewWindow(this); mWindow.setCallback(this); - mWindow.getLayoutInflater().setFactory2(this); + mWindow.getLayoutInflater().setPrivateFactory(this); if (info.softInputMode != WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED) { mWindow.setSoftInputMode(info.softInputMode); } diff --git a/core/java/android/app/StatusBarManager.java b/core/java/android/app/StatusBarManager.java index 97e6931..1af0983 100644 --- a/core/java/android/app/StatusBarManager.java +++ b/core/java/android/app/StatusBarManager.java @@ -22,6 +22,7 @@ import android.os.Binder; import android.os.RemoteException; import android.os.IBinder; import android.os.ServiceManager; +import android.view.View; import com.android.internal.statusbar.IStatusBarService; @@ -31,52 +32,24 @@ import com.android.internal.statusbar.IStatusBarService; * @hide */ public class StatusBarManager { - /** - * Flag for {@link #disable} to make the status bar not expandable. Unless you also - * set {@link #DISABLE_NOTIFICATION_ICONS}, new notifications will continue to show. - */ - public static final int DISABLE_EXPAND = 0x00000001; - - /** - * Flag for {@link #disable} to hide notification icons and scrolling ticker text. - */ - public static final int DISABLE_NOTIFICATION_ICONS = 0x00000002; - - /** - * Flag for {@link #disable} to disable incoming notification alerts. This will not block - * icons, but it will block sound, vibrating and other visual or aural notifications. - */ - public static final int DISABLE_NOTIFICATION_ALERTS = 0x00000004; - /** - * Flag for {@link #disable} to hide only the scrolling ticker. Note that - * {@link #DISABLE_NOTIFICATION_ICONS} implies {@link #DISABLE_NOTIFICATION_TICKER}. - */ - public static final int DISABLE_NOTIFICATION_TICKER = 0x00000008; + public static final int DISABLE_EXPAND = View.STATUS_BAR_DISABLE_EXPAND; + public static final int DISABLE_NOTIFICATION_ICONS = View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS; + public static final int DISABLE_NOTIFICATION_ALERTS + = View.STATUS_BAR_DISABLE_NOTIFICATION_ALERTS; + public static final int DISABLE_NOTIFICATION_TICKER + = View.STATUS_BAR_DISABLE_NOTIFICATION_TICKER; + public static final int DISABLE_SYSTEM_INFO = View.STATUS_BAR_DISABLE_SYSTEM_INFO; + public static final int DISABLE_NAVIGATION = View.STATUS_BAR_DISABLE_NAVIGATION; + public static final int DISABLE_BACK = View.STATUS_BAR_DISABLE_BACK; + public static final int DISABLE_CLOCK = View.STATUS_BAR_DISABLE_CLOCK; - /** - * Flag for {@link #disable} to hide the center system info area. - */ - public static final int DISABLE_SYSTEM_INFO = 0x00000010; - - /** - * Flag for {@link #disable} to hide only the navigation buttons. Don't use this - * unless you're a special part of the system UI (i.e., setup wizard, keyguard). - */ - public static final int DISABLE_NAVIGATION = 0x00000020; - - /** - * Flag for {@link #disable} to hide only the clock. You might use this if your activity has - * its own clock making the status bar's clock redundant. - */ - public static final int DISABLE_CLOCK = 0x00000040; - - - /** - * Re-enable all of the status bar features that you've disabled. - */ public static final int DISABLE_NONE = 0x00000000; + public static final int DISABLE_MASK = DISABLE_EXPAND | DISABLE_NOTIFICATION_ICONS + | DISABLE_NOTIFICATION_ALERTS | DISABLE_NOTIFICATION_TICKER + | DISABLE_SYSTEM_INFO| DISABLE_NAVIGATION | DISABLE_BACK | DISABLE_CLOCK; + private Context mContext; private IStatusBarService mService; private IBinder mToken = new Binder(); diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 255eb6c..a99256f 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -219,7 +219,34 @@ import java.io.PrintWriter; public class InputMethodService extends AbstractInputMethodService { static final String TAG = "InputMethodService"; static final boolean DEBUG = false; - + + /** + * The back button will close the input window. + */ + public static final int BACK_DISPOSITION_DEFAULT = 0; // based on window + + /** + * This input method will not consume the back key. + */ + public static final int BACK_DISPOSITION_WILL_NOT_DISMISS = 1; // back + + /** + * This input method will consume the back key. + */ + public static final int BACK_DISPOSITION_WILL_DISMISS = 2; // down + + /** + * @hide + * The IME is active. It may or may not be visible. + */ + public static final int IME_ACTIVE = 0x1; + + /** + * @hide + * The IME is visible. + */ + public static final int IME_VISIBLE = 0x2; + InputMethodManager mImm; int mTheme = 0; @@ -271,6 +298,7 @@ public class InputMethodService extends AbstractInputMethodService { boolean mIsInputViewShown; int mStatusIcon; + int mBackDisposition; final Insets mTmpInsets = new Insets(); final int[] mTmpLocation = new int[2]; @@ -394,9 +422,9 @@ public class InputMethodService extends AbstractInputMethodService { showWindow(true); } // If user uses hard keyboard, IME button should always be shown. - if (!onEvaluateInputViewShown()) { - mImm.setIMEButtonVisible(mToken, true); - } + boolean showing = onEvaluateInputViewShown(); + mImm.setImeWindowStatus(mToken, IME_ACTIVE | (showing ? IME_VISIBLE : 0), + mBackDisposition); if (resultReceiver != null) { resultReceiver.send(wasVis != isInputViewShown() ? InputMethodManager.RESULT_SHOWN @@ -704,9 +732,9 @@ public class InputMethodService extends AbstractInputMethodService { hideWindow(); } // If user uses hard keyboard, IME button should always be shown. - if (!onEvaluateInputViewShown()) { - mImm.setIMEButtonVisible(mToken, true); - } + boolean showing = onEvaluateInputViewShown(); + mImm.setImeWindowStatus(mToken, IME_ACTIVE | (showing ? IME_VISIBLE : 0), + mBackDisposition); } } @@ -736,6 +764,14 @@ public class InputMethodService extends AbstractInputMethodService { return mWindow; } + public void setBackDisposition(int disposition) { + mBackDisposition = disposition; + } + + public int getBackDisposition() { + return mBackDisposition; + } + /** * Return the maximum width, in pixels, available the input method. * Input methods are positioned at the bottom of the screen and, unless @@ -1378,7 +1414,7 @@ public class InputMethodService extends AbstractInputMethodService { if (!wasVisible) { if (DEBUG) Log.v(TAG, "showWindow: showing!"); - mImm.setIMEButtonVisible(mToken, true); + mImm.setImeWindowStatus(mToken, IME_ACTIVE, mBackDisposition); onWindowShown(); mWindow.show(); } @@ -1394,7 +1430,7 @@ public class InputMethodService extends AbstractInputMethodService { } mInputViewStarted = false; mCandidatesViewStarted = false; - mImm.setIMEButtonVisible(mToken, false); + mImm.setImeWindowStatus(mToken, 0, mBackDisposition); if (mWindowVisible) { mWindow.hide(); mWindowVisible = false; diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 7748265..d5010c6 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -1142,7 +1142,7 @@ public class TextUtils { // XXX this is probably ok, but need to look at it more tempMt.setPara(format, 0, format.length(), request); - float moreWid = mt.addStyleRun(p, mt.mLen, null); + float moreWid = tempMt.addStyleRun(p, tempMt.mLen, null); if (w + moreWid <= avail) { ok = i + 1; diff --git a/core/java/android/view/LayoutInflater.java b/core/java/android/view/LayoutInflater.java index d24af52..a17ed9d 100644 --- a/core/java/android/view/LayoutInflater.java +++ b/core/java/android/view/LayoutInflater.java @@ -68,6 +68,7 @@ public abstract class LayoutInflater { private boolean mFactorySet; private Factory mFactory; private Factory2 mFactory2; + private Factory2 mPrivateFactory; private Filter mFilter; private final Object[] mConstructorArgs = new Object[2]; @@ -193,6 +194,7 @@ public abstract class LayoutInflater { mContext = newContext; mFactory = original.mFactory; mFactory2 = original.mFactory2; + mPrivateFactory = original.mPrivateFactory; mFilter = original.mFilter; } @@ -300,6 +302,13 @@ public abstract class LayoutInflater { } /** + * @hide for use by framework + */ + public void setPrivateFactory(Factory2 factory) { + mPrivateFactory = factory; + } + + /** * @return The {@link Filter} currently used by this LayoutInflater to restrict the set of Views * that are allowed to be inflated. */ @@ -651,6 +660,10 @@ public abstract class LayoutInflater { else if (mFactory != null) view = mFactory.onCreateView(name, mContext, attrs); else view = null; + if (view == null && mPrivateFactory != null) { + view = mPrivateFactory.onCreateView(parent, name, mContext, attrs); + } + if (view == null) { if (-1 == name.indexOf('.')) { view = onCreateView(parent, name, attrs); diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 966bd8d..87b3d79 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -174,6 +174,7 @@ public class SurfaceView extends View { return true; } }; + private boolean mGlobalListenersAdded; public SurfaceView(Context context) { super(context); @@ -212,9 +213,13 @@ public class SurfaceView extends View { mLayout.token = getWindowToken(); mLayout.setTitle("SurfaceView"); mViewVisibility = getVisibility() == VISIBLE; - ViewTreeObserver observer = getViewTreeObserver(); - observer.addOnScrollChangedListener(mScrollChangedListener); - observer.addOnPreDrawListener(mDrawListener); + + if (!mGlobalListenersAdded) { + ViewTreeObserver observer = getViewTreeObserver(); + observer.addOnScrollChangedListener(mScrollChangedListener); + observer.addOnPreDrawListener(mDrawListener); + mGlobalListenersAdded = true; + } } @Override @@ -275,9 +280,13 @@ public class SurfaceView extends View { @Override protected void onDetachedFromWindow() { - ViewTreeObserver observer = getViewTreeObserver(); - observer.removeOnScrollChangedListener(mScrollChangedListener); - observer.removeOnPreDrawListener(mDrawListener); + if (mGlobalListenersAdded) { + ViewTreeObserver observer = getViewTreeObserver(); + observer.removeOnScrollChangedListener(mScrollChangedListener); + observer.removeOnPreDrawListener(mDrawListener); + mGlobalListenersAdded = false; + } + mRequestedVisible = false; updateWindow(false, false); mHaveFrame = false; @@ -285,6 +294,7 @@ public class SurfaceView extends View { try { mSession.remove(mWindow); } catch (RemoteException ex) { + // Not much we can do here... } mWindow = null; } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index d0b150b..142061b 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1732,6 +1732,102 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility public static final int STATUS_BAR_HIDDEN = 0x00000001; /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to make the status bar not expandable. Unless you also + * set {@link #STATUS_BAR_DISABLE_NOTIFICATION_ICONS}, new notifications will continue to show. + */ + public static final int STATUS_BAR_DISABLE_EXPAND = 0x00010000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide notification icons and scrolling ticker text. + */ + public static final int STATUS_BAR_DISABLE_NOTIFICATION_ICONS = 0x00020000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to disable incoming notification alerts. This will not block + * icons, but it will block sound, vibrating and other visual or aural notifications. + */ + public static final int STATUS_BAR_DISABLE_NOTIFICATION_ALERTS = 0x00040000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide only the scrolling ticker. Note that + * {@link #STATUS_BAR_DISABLE_NOTIFICATION_ICONS} implies + * {@link #STATUS_BAR_DISABLE_NOTIFICATION_TICKER}. + */ + public static final int STATUS_BAR_DISABLE_NOTIFICATION_TICKER = 0x00080000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide the center system info area. + */ + public static final int STATUS_BAR_DISABLE_SYSTEM_INFO = 0x00100000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide only the navigation buttons. Don't use this + * unless you're a special part of the system UI (i.e., setup wizard, keyguard). + * + * THIS DOES NOT DISABLE THE BACK BUTTON + */ + public static final int STATUS_BAR_DISABLE_NAVIGATION = 0x00200000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide only the back button. Don't use this + * unless you're a special part of the system UI (i.e., setup wizard, keyguard). + */ + public static final int STATUS_BAR_DISABLE_BACK = 0x00400000; + + /** + * @hide + * + * NOTE: This flag may only be used in subtreeSystemUiVisibility. It is masked + * out of the public fields to keep the undefined bits out of the developer's way. + * + * Flag to hide only the clock. You might use this if your activity has + * its own clock making the status bar's clock redundant. + */ + public static final int STATUS_BAR_DISABLE_CLOCK = 0x00800000; + + + /** + * @hide + */ + public static final int PUBLIC_STATUS_BAR_VISIBILITY_MASK = STATUS_BAR_HIDDEN; + + + /** * Controls the over-scroll mode for this view. * See {@link #overScrollBy(int, int, int, int, int, int, int, int, boolean)}, * {@link #OVER_SCROLL_ALWAYS}, {@link #OVER_SCROLL_IF_CONTENT_SCROLLS}, @@ -7801,7 +7897,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } void dispatchDetachedFromWindow() { - //System.out.println("Detached! " + this); AttachInfo info = mAttachInfo; if (info != null) { int vis = info.mWindowVisibility; @@ -7811,10 +7906,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } onDetachedFromWindow(); - if ((mPrivateFlags&SCROLL_CONTAINER_ADDED) != 0) { + + if ((mPrivateFlags & SCROLL_CONTAINER_ADDED) != 0) { mAttachInfo.mScrollContainers.remove(this); mPrivateFlags &= ~SCROLL_CONTAINER_ADDED; } + mAttachInfo = null; } @@ -10839,7 +10936,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility public void dispatchSystemUiVisibilityChanged(int visibility) { mSystemUiVisibility = visibility; if (mOnSystemUiVisibilityChangeListener != null) { - mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange(visibility); + mOnSystemUiVisibilityChangeListener.onSystemUiVisibilityChange( + visibility & ~PUBLIC_STATUS_BAR_VISIBILITY_MASK); } } diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index 7edfd7b..cb67b78 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -531,9 +531,9 @@ public final class InputMethodManager { } /** @hide */ - public void setIMEButtonVisible(IBinder imeToken, boolean visible) { + public void setImeWindowStatus(IBinder imeToken, int vis, int backDisposition) { try { - mService.setIMEButtonVisible(imeToken, visible); + mService.setImeWindowStatus(imeToken, vis, backDisposition); } catch (RemoteException e) { throw new RuntimeException(e); } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index b217052..10ec6ca 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -4608,9 +4608,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mInput.onKeyDown(this, (Editable)mText, keyCode, down); mInput.onKeyUp(this, (Editable)mText, keyCode, up); } - if (mError != null && !mErrorWasChanged) { - setError(null, null); - } + hideErrorIfUnchanged(); } else if (which == 2) { mMovement.onKeyUp(this, (Spannable)mText, keyCode, up); @@ -4731,13 +4729,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener } if (mInput != null) { - /* - * Keep track of what the error was before doing the input - * so that if an input filter changed the error, we leave - * that error showing. Otherwise, we take down whatever - * error was showing when the user types something. - */ - mErrorWasChanged = false; + resetErrorChangedFlag(); boolean doDown = true; if (otherEvent != null) { @@ -4745,9 +4737,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener beginBatchEdit(); boolean handled = mInput.onKeyOther(this, (Editable) mText, otherEvent); - if (mError != null && !mErrorWasChanged) { - setError(null, null); - } + hideErrorIfUnchanged(); doDown = false; if (handled) { return -1; @@ -4764,9 +4754,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener beginBatchEdit(); if (mInput.onKeyDown(this, (Editable) mText, keyCode, event)) { endBatchEdit(); - if (mError != null && !mErrorWasChanged) { - setError(null, null); - } + hideErrorIfUnchanged(); return 1; } endBatchEdit(); @@ -4800,6 +4788,30 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener return 0; } + /** + * Resets the mErrorWasChanged flag, so that future calls to {@link #setError(CharSequence)} + * can be recorded. + * @hide + */ + public void resetErrorChangedFlag() { + /* + * Keep track of what the error was before doing the input + * so that if an input filter changed the error, we leave + * that error showing. Otherwise, we take down whatever + * error was showing when the user types something. + */ + mErrorWasChanged = false; + } + + /** + * @hide + */ + public void hideErrorIfUnchanged() { + if (mError != null && !mErrorWasChanged) { + setError(null, null); + } + } + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if (!isEnabled()) { diff --git a/core/java/com/android/internal/statusbar/IStatusBar.aidl b/core/java/com/android/internal/statusbar/IStatusBar.aidl index 1cc068f..5fcd0c2 100644 --- a/core/java/com/android/internal/statusbar/IStatusBar.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBar.aidl @@ -32,6 +32,6 @@ oneway interface IStatusBar void animateCollapse(); void setLightsOn(boolean on); void setMenuKeyVisible(boolean visible); - void setIMEButtonVisible(in IBinder token, boolean visible); + void setImeWindowStatus(in IBinder token, int vis, int backDisposition); } diff --git a/core/java/com/android/internal/statusbar/IStatusBarService.aidl b/core/java/com/android/internal/statusbar/IStatusBarService.aidl index d1ea52e..c62aeb0 100644 --- a/core/java/com/android/internal/statusbar/IStatusBarService.aidl +++ b/core/java/com/android/internal/statusbar/IStatusBarService.aidl @@ -31,7 +31,7 @@ interface IStatusBarService void setIconVisibility(String slot, boolean visible); void removeIcon(String slot); void setMenuKeyVisible(boolean visible); - void setIMEButtonVisible(in IBinder token, boolean visible); + void setImeWindowStatus(in IBinder token, int vis, int backDisposition); // ---- Methods below are for use by the status bar policy services ---- // You need the STATUS_BAR_SERVICE permission diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index b2fbd3a..611d987 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -59,7 +59,7 @@ interface IInputMethodManager { void hideMySoftInput(in IBinder token, int flags); void showMySoftInput(in IBinder token, int flags); void updateStatusIcon(in IBinder token, String packageName, int iconId); - void setIMEButtonVisible(in IBinder token, boolean visible); + void setImeWindowStatus(in IBinder token, int vis, int backDisposition); InputMethodSubtype getCurrentInputMethodSubtype(); boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype); boolean switchToLastInputMethod(in IBinder token); diff --git a/core/java/com/android/internal/widget/EditableInputConnection.java b/core/java/com/android/internal/widget/EditableInputConnection.java index e992e7c..9f9f020 100644 --- a/core/java/com/android/internal/widget/EditableInputConnection.java +++ b/core/java/com/android/internal/widget/EditableInputConnection.java @@ -138,9 +138,9 @@ public class EditableInputConnection extends BaseInputConnection { return super.commitText(text, newCursorPosition); } - CharSequence errorBefore = mTextView.getError(); + mTextView.resetErrorChangedFlag(); boolean success = super.commitText(text, newCursorPosition); - CharSequence errorAfter = mTextView.getError(); + mTextView.hideErrorIfUnchanged(); return success; } diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_content.xml b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml index 1a3ee82..676c38b 100644 --- a/core/res/res/layout-xlarge/status_bar_latest_event_content.xml +++ b/core/res/res/layout-xlarge/status_bar_latest_event_content.xml @@ -23,14 +23,14 @@ android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" - android:layout_marginBottom="-4dp" + android:layout_marginBottom="-3dp" /> <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginTop="-4dp" + android:layout_marginTop="-2dp" android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml b/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml index e9b106d..ebdaaa3 100644 --- a/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml +++ b/core/res/res/layout-xlarge/status_bar_latest_event_content_large_icon.xml @@ -17,40 +17,34 @@ android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" - android:layout_marginBottom="-4dp" + android:layout_marginBottom="-3dp" /> <TextView android:id="@+id/text" android:textAppearance="@style/TextAppearance.StatusBar.EventContent" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" - android:layout_marginTop="-4dp" + android:layout_marginTop="-2dp" android:singleLine="true" android:ellipsize="marquee" android:fadingEdge="horizontal" /> </LinearLayout> - <RelativeLayout + <TextView android:id="@+id/info" + android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" android:layout_width="wrap_content" android:layout_height="match_parent" - > - <TextView android:id="@+id/info" - android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Info" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:singleLine="true" - android:gravity="center_vertical" - android:layout_alignParentLeft="true" - android:paddingLeft="8dp" - /> - <ImageView android:id="@+id/icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentBottom="true" - android:layout_alignRight="@id/info" - android:layout_marginBottom="8dip" - android:scaleType="center" - /> - </RelativeLayout> + android:singleLine="true" + android:gravity="center_vertical" + android:paddingLeft="4dp" + android:paddingRight="4dp" + /> + <ImageView android:id="@+id/icon" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginBottom="13dip" + android:scaleType="center" + /> </LinearLayout> diff --git a/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml b/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml index b382c55..ff0f7d4 100644 --- a/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml +++ b/core/res/res/layout-xlarge/status_bar_latest_event_ticker_large_icon.xml @@ -37,11 +37,13 @@ android:layout_marginTop="-10dp" /> <ImageView android:id="@+id/icon" - android:layout_width="48dp" - android:layout_height="32dp" - android:layout_gravity="top" - android:layout_marginTop="6dp" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:layout_marginBottom="13dip" android:scaleType="center" + android:layout_marginRight="4dip" + android:layout_marginLeft="16dip" /> </LinearLayout> diff --git a/core/res/res/layout/action_menu_item_layout.xml b/core/res/res/layout/action_menu_item_layout.xml index 4477df7..15dfea3 100644 --- a/core/res/res/layout/action_menu_item_layout.xml +++ b/core/res/res/layout/action_menu_item_layout.xml @@ -40,9 +40,9 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:visibility="gone" - android:textAppearance="?attr/textAppearanceMedium" + android:textAppearance="?attr/actionMenuTextAppearance" style="?attr/buttonStyleSmall" - android:textColor="?attr/textColorPrimary" + android:textColor="?attr/actionMenuTextColor" android:background="@null" android:paddingLeft="4dip" android:paddingRight="4dip" /> diff --git a/core/res/res/values-xlarge/styles.xml b/core/res/res/values-xlarge/styles.xml index ed05cb1..dd78920 100644 --- a/core/res/res/values-xlarge/styles.xml +++ b/core/res/res/values-xlarge/styles.xml @@ -30,6 +30,7 @@ </style> <style name="TextAppearance.StatusBar.EventContent"> <item name="android:textColor">#ff999999</item> + <item name="android:textSize">14sp</item> </style> <style name="TextAppearance.StatusBar.EventContent.Title"> <item name="android:textColor">?android:attr/textColorPrimary</item> diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index 4a56532..f980970 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -587,7 +587,11 @@ <attr name="actionBarSize" format="dimension" > <enum name="wrap_content" value="0" /> </attr> - + <!-- TextAppearance style that will be applied to text that + appears within action menu items. --> + <attr name="actionMenuTextAppearance" format="reference" /> + <!-- Color for text that appears within action menu items. --> + <attr name="actionMenuTextColor" format="color|reference" /> <!-- =================== --> <!-- Action mode styles --> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 957707d..02b42d0 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1430,6 +1430,8 @@ <public type="attr" name="calendarViewStyle" /> <public type="attr" name="textEditSidePasteWindowLayout" /> <public type="attr" name="textEditSideNoPasteWindowLayout" /> + <public type="attr" name="actionMenuTextAppearance" /> + <public type="attr" name="actionMenuTextColor" /> <!-- A simple fade-in animation. --> <public type="animator" name="fade_in" id="0x010b0000" /> diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml index b828318..f54f8cc 100644 --- a/core/res/res/values/styles.xml +++ b/core/res/res/values/styles.xml @@ -224,7 +224,7 @@ <item name="android:textStyle">bold</item> </style> <style name="TextAppearance.StatusBar.EventContent"> - <item name="android:textSize">10sp</item> + <item name="android:textAppearance">?android:attr/textAppearanceSmall</item> <item name="android:textColor">?android:attr/textColorPrimaryInverse</item> </style> <style name="TextAppearance.StatusBar.EventContent.Title"> diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml index c5ae77f..38b068e 100644 --- a/core/res/res/values/themes.xml +++ b/core/res/res/values/themes.xml @@ -270,6 +270,8 @@ <item name="actionBarStyle">@android:style/Widget.ActionBar</item> <item name="actionBarSize">56dip</item> <item name="actionModePopupWindowStyle">?android:attr/popupWindowStyle</item> + <item name="actionMenuTextAppearance">?android:attr/textAppearanceMedium</item> + <item name="actionMenuTextColor">?android:attr/textColorPrimary</item> <item name="dividerVertical">@drawable/divider_vertical_dark</item> <item name="dividerHorizontal">@drawable/divider_vertical_dark</item> diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 0ed8be5..c0e4e0f 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -88,7 +88,7 @@ int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { int buf = -1; status_t err = mSurfaceTexture->dequeueBuffer(&buf); if (err < 0) { - LOGE("dequeueBuffer: ISurfaceTexture::dequeueBuffer failed: %d", err); + LOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer failed: %d", err); return err; } sp<GraphicBuffer>& gbuf(mSlots[buf]); diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 11ac56c..89b3dab 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -378,14 +378,11 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) { } void AwesomePlayer::reset() { - LOGI("reset"); - Mutex::Autolock autoLock(mLock); reset_l(); } void AwesomePlayer::reset_l() { - LOGI("reset_l"); mDisplayWidth = 0; mDisplayHeight = 0; @@ -411,10 +408,6 @@ void AwesomePlayer::reset_l() { } } - if (mFlags & PREPARING) { - LOGI("waiting until preparation is completes."); - } - while (mFlags & PREPARING) { mPreparedCondition.wait(mLock); } @@ -438,8 +431,6 @@ void AwesomePlayer::reset_l() { } mAudioSource.clear(); - LOGI("audio source cleared"); - mTimeSource = NULL; delete mAudioPlayer; @@ -480,8 +471,6 @@ void AwesomePlayer::reset_l() { IPCThreadState::self()->flushCommands(); } - LOGI("video source cleared"); - mDurationUs = -1; mFlags = 0; mExtractorFlags = 0; @@ -498,8 +487,6 @@ void AwesomePlayer::reset_l() { mFileSource.clear(); mBitrate = -1; - - LOGI("reset_l completed"); } void AwesomePlayer::notifyListener_l(int msg, int ext1, int ext2) { diff --git a/packages/SystemUI/res/layout-xlarge/status_bar.xml b/packages/SystemUI/res/layout-xlarge/status_bar.xml index f355e17..6c173c9 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar.xml @@ -44,20 +44,20 @@ /> <!-- navigation controls --> + <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" + android:layout_width="80dip" + android:layout_height="match_parent" + android:src="@drawable/ic_sysbar_back" + android:layout_alignParentLeft="true" + systemui:keyCode="4" + /> <LinearLayout android:id="@+id/navigationArea" android:layout_width="wrap_content" android:layout_height="match_parent" - android:layout_alignParentLeft="true" + android:layout_toRightOf="@+id/back" android:orientation="horizontal" > - - <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/back" - android:layout_width="80dip" - android:layout_height="match_parent" - android:src="@drawable/ic_sysbar_back" - systemui:keyCode="4" - /> <com.android.systemui.statusbar.policy.KeyButtonView android:id="@+id/home" android:layout_width="80dip" android:layout_height="match_parent" diff --git a/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml index 0f3f5f0..8e456b2 100644 --- a/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml +++ b/packages/SystemUI/res/layout-xlarge/status_bar_notification_row.xml @@ -27,7 +27,7 @@ <com.android.systemui.statusbar.LatestItemView android:id="@+id/content" android:layout_width="match_parent" - android:layout_height="64sp" + android:layout_height="64dp" android:layout_alignParentTop="true" android:layout_toRightOf="@id/large_icon" android:layout_toLeftOf="@id/veto" diff --git a/packages/SystemUI/res/values-xlarge/styles.xml b/packages/SystemUI/res/values-xlarge/styles.xml index fb10a24..c1cd533 100644 --- a/packages/SystemUI/res/values-xlarge/styles.xml +++ b/packages/SystemUI/res/values-xlarge/styles.xml @@ -39,6 +39,7 @@ <item name="android:layout_weight">1</item> <item name="android:layout_gravity">left|center_vertical</item> <item name="android:textColor">?android:attr/textColorPrimary</item> + <item name="android:textSize">18sp</item> </style> <style name="StatusBarPanelSettingsPanelSeparator"> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java index 37939df..76aa793 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java @@ -82,7 +82,7 @@ public class CommandQueue extends IStatusBar.Stub { public void animateCollapse(); public void setLightsOn(boolean on); public void setMenuKeyVisible(boolean visible); - public void setIMEButtonVisible(IBinder token, boolean visible); + public void setImeWindowStatus(IBinder token, int vis, int backDisposition); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { @@ -165,10 +165,11 @@ public class CommandQueue extends IStatusBar.Stub { } } - public void setIMEButtonVisible(IBinder token, boolean visible) { + public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { synchronized (mList) { mHandler.removeMessages(MSG_SHOW_IME_BUTTON); - mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, visible ? 1 : 0, 0, token).sendToTarget(); + mHandler.obtainMessage(MSG_SHOW_IME_BUTTON, vis, backDisposition, token) + .sendToTarget(); } } @@ -233,7 +234,7 @@ public class CommandQueue extends IStatusBar.Stub { mCallbacks.setMenuKeyVisible(msg.arg1 != 0); break; case MSG_SHOW_IME_BUTTON: - mCallbacks.setIMEButtonVisible((IBinder)msg.obj, msg.arg1 != 0); + mCallbacks.setImeWindowStatus((IBinder)msg.obj, msg.arg1, msg.arg2); break; } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java index 8fca759..da8e831 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBar.java @@ -67,7 +67,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac mCommandQueue = new CommandQueue(this, iconList); mBarService = IStatusBarService.Stub.asInterface( ServiceManager.getService(Context.STATUS_BAR_SERVICE)); - int[] switches = new int[4]; + int[] switches = new int[5]; ArrayList<IBinder> binders = new ArrayList<IBinder>(); try { mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications, @@ -80,7 +80,7 @@ public abstract class StatusBar extends SystemUI implements CommandQueue.Callbac setLightsOn(switches[1] != 0); setMenuKeyVisible(switches[2] != 0); // StatusBarManagerService has a back up of IME token and it's restored here. - setIMEButtonVisible(binders.get(0), switches[3] != 0); + setImeWindowStatus(binders.get(0), switches[3], switches[4]); // Set up the initial icon state int N = iconList.size(); 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 132433b..9505391 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1020,7 +1020,7 @@ public class PhoneStatusBar extends StatusBar { // Not supported public void setMenuKeyVisible(boolean visible) { } - public void setIMEButtonVisible(IBinder token, boolean visible) { } + public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { } private class Launcher implements View.OnClickListener { private PendingIntent mIntent; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java index 28f485c..f131111 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/InputMethodButton.java @@ -53,7 +53,7 @@ public class InputMethodButton extends ImageView { private final int mId; private ImageView mIcon; private IBinder mToken; - private boolean mKeyboardVisible = false; + private boolean mShowButton = false; private boolean mScreenLocked = false; private InputMethodInfo mShortcutInfo; private InputMethodSubtype mShortcutSubtype; @@ -144,7 +144,7 @@ public class InputMethodButton extends ImageView { // * There are no explicitly enabled (by the user) subtypes of the IME, or the IME doesn't have // its subtypes at all private boolean needsToShowIMEButton() { - if (!mKeyboardVisible || mScreenLocked) return false; + if (!mShowButton || mScreenLocked) return false; List<InputMethodInfo> imis = mImm.getEnabledInputMethodList(); final int size = imis.size(); final int visibility = loadInputMethodSelectorVisibility(); @@ -194,9 +194,9 @@ public class InputMethodButton extends ImageView { } } - public void setIMEButtonVisible(IBinder token, boolean keyboardVisible) { + public void setImeWindowStatus(IBinder token, boolean showButton) { mToken = token; - mKeyboardVisible = keyboardVisible; + mShowButton = showButton; refreshStatusIcon(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index eaa5cc9..6c8a20d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -33,6 +33,7 @@ import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; +import android.inputmethodservice.InputMethodService; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Drawable; @@ -367,8 +368,8 @@ public class TabletStatusBar extends StatusBar implements (ImageView)sb.findViewById(R.id.network_type)); // The navigation buttons + mBackButton = (ImageView)sb.findViewById(R.id.back); mNavigationArea = sb.findViewById(R.id.navigationArea); - mBackButton = (ImageView)mNavigationArea.findViewById(R.id.back); mHomeButton = mNavigationArea.findViewById(R.id.home); mMenuButton = mNavigationArea.findViewById(R.id.menu); mRecentButton = mNavigationArea.findViewById(R.id.recent_apps); @@ -792,6 +793,18 @@ public class TabletStatusBar extends StatusBar implements mInputMethodSwitchButton.setScreenLocked(false); } } + if ((diff & StatusBarManager.DISABLE_BACK) != 0) { + if ((state & StatusBarManager.DISABLE_BACK) != 0) { + Slog.i(TAG, "DISABLE_BACK: yes"); + mBackButton.setVisibility(View.INVISIBLE); + mInputMethodSwitchButton.setScreenLocked(true); + } else { + Slog.i(TAG, "DISABLE_BACK: no"); + mBackButton.setVisibility(View.VISIBLE); + mInputMethodSwitchButton.setScreenLocked(false); + } + } + } private boolean hasTicker(Notification n) { @@ -863,17 +876,32 @@ public class TabletStatusBar extends StatusBar implements if (visible) setLightsOn(true); } - public void setIMEButtonVisible(IBinder token, boolean visible) { - if (DEBUG) { - Slog.d(TAG, (visible?"showing":"hiding") + " the IME button"); - } - mInputMethodSwitchButton.setIMEButtonVisible(token, visible); + public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { + mInputMethodSwitchButton.setImeWindowStatus(token, + (vis & InputMethodService.IME_ACTIVE) != 0); updateNotificationIcons(); mInputMethodsPanel.setImeToken(token); - mBackButton.setImageResource( - visible ? R.drawable.ic_sysbar_back_ime : R.drawable.ic_sysbar_back); + int res; + switch (backDisposition) { + case InputMethodService.BACK_DISPOSITION_WILL_NOT_DISMISS: + res = R.drawable.ic_sysbar_back; + break; + case InputMethodService.BACK_DISPOSITION_WILL_DISMISS: + res = R.drawable.ic_sysbar_back_ime; + break; + case InputMethodService.BACK_DISPOSITION_DEFAULT: + default: + if ((vis & InputMethodService.IME_VISIBLE) != 0) { + res = R.drawable.ic_sysbar_back_ime; + } else { + res = R.drawable.ic_sysbar_back; + } + break; + } + mBackButton.setImageResource(res); if (FAKE_SPACE_BAR) { - mFakeSpaceBar.setVisibility(visible ? View.VISIBLE : View.GONE); + mFakeSpaceBar.setVisibility(((vis & InputMethodService.IME_VISIBLE) != 0) + ? View.VISIBLE : View.GONE); } } diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java index 6b52454..36afd75 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java @@ -50,6 +50,8 @@ public abstract class KeyguardViewBase extends FrameLayout { public KeyguardViewBase(Context context) { super(context); + setSystemUiVisibility(STATUS_BAR_DISABLE_BACK); + // This is a faster way to draw the background on devices without hardware acceleration setBackgroundDrawable(new Drawable() { @Override @@ -235,4 +237,9 @@ public abstract class KeyguardViewBase extends FrameLayout { return false; } + @Override + public void dispatchSystemUiVisibilityChanged(int visibility) { + super.dispatchSystemUiVisibilityChanged(visibility); + setSystemUiVisibility(STATUS_BAR_DISABLE_BACK); + } } diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 0147b1a..8d6d3a1 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -49,6 +49,7 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.database.ContentObserver; +import android.inputmethodservice.InputMethodService; import android.os.Binder; import android.os.Handler; import android.os.IBinder; @@ -311,6 +312,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub */ boolean mScreenOn = true; + int mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; + int mImeWindowVis; + AlertDialog.Builder mDialogBuilder; AlertDialog mSwitchingDialog; InputMethodInfo[] mIms; @@ -430,7 +434,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // Uh oh, current input method is no longer around! // Pick another one... Slog.i(TAG, "Current input method removed: " + curInputMethodId); - mStatusBar.setIMEButtonVisible(mCurToken, false); + mImeWindowVis = 0; + mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis, + mBackDisposition); if (!chooseNewDefaultIMELocked()) { changed = true; curIm = null; @@ -982,17 +988,19 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } - public void setIMEButtonVisible(IBinder token, boolean visible) { + public void setImeWindowStatus(IBinder token, int vis, int backDisposition) { int uid = Binder.getCallingUid(); long ident = Binder.clearCallingIdentity(); try { if (token == null || mCurToken != token) { - Slog.w(TAG, "Ignoring setIMEButtonVisible of uid " + uid + " token: " + token); + Slog.w(TAG, "Ignoring setImeWindowStatus of uid " + uid + " token: " + token); return; } synchronized (mMethodMap) { - mStatusBar.setIMEButtonVisible(token, visible); + mImeWindowVis = vis; + mBackDisposition = backDisposition; + mStatusBar.setImeWindowStatus(token, vis, backDisposition); } } finally { Binder.restoreCallingIdentity(ident); @@ -1045,12 +1053,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } if (mCurMethod != null) { try { - if (mInputShown) { - // If mInputShown is false, there is no IME button on the - // system bar. - // Thus there is no need to make it invisible explicitly. - mStatusBar.setIMEButtonVisible(mCurToken, true); - } + mImeWindowVis = 0; + mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis, + mBackDisposition); // If subtype is null, try to find the most applicable one from // getCurrentInputMethodSubtype. if (subtype == null) { @@ -1168,11 +1173,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (!mIWindowManager.inputMethodClientHasFocus(client)) { if (DEBUG) Slog.w(TAG, "Ignoring hideSoftInput of uid " + uid + ": " + client); - mStatusBar.setIMEButtonVisible(mCurToken, false); + mImeWindowVis = 0; + mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis, + mBackDisposition); return false; } } catch (RemoteException e) { - mStatusBar.setIMEButtonVisible(mCurToken, false); + mImeWindowVis = 0; + mStatusBar.setImeWindowStatus(mCurToken, mImeWindowVis, mBackDisposition); return false; } } diff --git a/services/java/com/android/server/StatusBarManagerService.java b/services/java/com/android/server/StatusBarManagerService.java index bdaa3b0..1a2f867 100644 --- a/services/java/com/android/server/StatusBarManagerService.java +++ b/services/java/com/android/server/StatusBarManagerService.java @@ -67,14 +67,16 @@ public class StatusBarManagerService extends IStatusBarService.Stub // for disabling the status bar ArrayList<DisableRecord> mDisableRecords = new ArrayList<DisableRecord>(); + IBinder mSysUiVisToken = new Binder(); int mDisabled = 0; Object mLock = new Object(); // We usually call it lights out mode, but double negatives are annoying boolean mLightsOn = true; boolean mMenuVisible = false; - boolean mIMEButtonVisible = false; - IBinder mIMEToken = null; + int mImeWindowVis = 0; + int mImeBackDisposition; + IBinder mImeToken = null; private class DisableRecord implements IBinder.DeathRecipient { String pkg; @@ -140,25 +142,29 @@ public class StatusBarManagerService extends IStatusBarService.Stub public void disable(int what, IBinder token, String pkg) { enforceStatusBar(); + synchronized (mLock) { + disableLocked(what, token, pkg); + } + } + + private void disableLocked(int what, IBinder token, String pkg) { // It's important that the the callback and the call to mBar get done // in the same order when multiple threads are calling this function // so they are paired correctly. The messages on the handler will be // handled in the order they were enqueued, but will be outside the lock. - synchronized (mDisableRecords) { - manageDisableListLocked(what, token, pkg); - final int net = gatherDisableActionsLocked(); - if (net != mDisabled) { - mDisabled = net; - mHandler.post(new Runnable() { - public void run() { - mNotificationCallbacks.onSetDisabled(net); - } - }); - if (mBar != null) { - try { - mBar.disable(net); - } catch (RemoteException ex) { + manageDisableListLocked(what, token, pkg); + final int net = gatherDisableActionsLocked(); + if (net != mDisabled) { + mDisabled = net; + mHandler.post(new Runnable() { + public void run() { + mNotificationCallbacks.onSetDisabled(net); } + }); + if (mBar != null) { + try { + mBar.disable(net); + } catch (RemoteException ex) { } } } @@ -259,22 +265,25 @@ public class StatusBarManagerService extends IStatusBarService.Stub } } - public void setIMEButtonVisible(final IBinder token, final boolean visible) { + public void setImeWindowStatus(final IBinder token, final int vis, final int backDisposition) { enforceStatusBar(); - if (SPEW) Slog.d(TAG, (visible?"showing":"hiding") + " IME Button"); + if (SPEW) { + Slog.d(TAG, "swetImeWindowStatus vis=" + vis + " backDisposition=" + backDisposition); + } synchronized(mLock) { - // In case of IME change, we need to call up setIMEButtonVisible() regardless of - // mIMEButtonVisible because mIMEButtonVisible may not have been set to false when the + // In case of IME change, we need to call up setImeWindowStatus() regardless of + // mImeWindowVis because mImeWindowVis may not have been set to false when the // previous IME was destroyed. - mIMEButtonVisible = visible; - mIMEToken = token; + mImeWindowVis = vis; + mImeBackDisposition = backDisposition; + mImeToken = token; mHandler.post(new Runnable() { public void run() { if (mBar != null) { try { - mBar.setIMEButtonVisible(token, visible); + mBar.setImeWindowStatus(token, vis, backDisposition); } catch (RemoteException ex) { } } @@ -290,6 +299,8 @@ public class StatusBarManagerService extends IStatusBarService.Stub synchronized (mLock) { final boolean lightsOn = (vis & View.STATUS_BAR_HIDDEN) == 0; updateLightsOnLocked(lightsOn); + disableLocked(vis & StatusBarManager.DISABLE_MASK, mSysUiVisToken, + "WindowManager.LayoutParams"); } } @@ -348,8 +359,9 @@ public class StatusBarManagerService extends IStatusBarService.Stub switches[0] = gatherDisableActionsLocked(); switches[1] = mLightsOn ? 1 : 0; switches[2] = mMenuVisible ? 1 : 0; - switches[3] = mIMEButtonVisible ? 1 : 0; - binders.add(mIMEToken); + switches[3] = mImeWindowVis; + switches[4] = mImeBackDisposition; + binders.add(mImeToken); } } @@ -447,37 +459,35 @@ public class StatusBarManagerService extends IStatusBarService.Stub Slog.d(TAG, "manageDisableList what=0x" + Integer.toHexString(what) + " pkg=" + pkg); } // update the list - synchronized (mDisableRecords) { - final int N = mDisableRecords.size(); - DisableRecord tok = null; - int i; - for (i=0; i<N; i++) { - DisableRecord t = mDisableRecords.get(i); - if (t.token == token) { - tok = t; - break; - } + final int N = mDisableRecords.size(); + DisableRecord tok = null; + int i; + for (i=0; i<N; i++) { + DisableRecord t = mDisableRecords.get(i); + if (t.token == token) { + tok = t; + break; } - if (what == 0 || !token.isBinderAlive()) { - if (tok != null) { - mDisableRecords.remove(i); - tok.token.unlinkToDeath(tok, 0); + } + if (what == 0 || !token.isBinderAlive()) { + if (tok != null) { + mDisableRecords.remove(i); + tok.token.unlinkToDeath(tok, 0); + } + } else { + if (tok == null) { + tok = new DisableRecord(); + try { + token.linkToDeath(tok, 0); } - } else { - if (tok == null) { - tok = new DisableRecord(); - try { - token.linkToDeath(tok, 0); - } - catch (RemoteException ex) { - return; // give up - } - mDisableRecords.add(tok); + catch (RemoteException ex) { + return; // give up } - tok.what = what; - tok.token = token; - tok.pkg = pkg; + mDisableRecords.add(tok); } + tok.what = what; + tok.token = token; + tok.pkg = pkg; } } @@ -518,7 +528,7 @@ public class StatusBarManagerService extends IStatusBarService.Stub } } - synchronized (mDisableRecords) { + synchronized (mLock) { final int N = mDisableRecords.size(); pw.println(" mDisableRecords.size=" + N + " mDisabled=0x" + Integer.toHexString(mDisabled)); diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java index fcc8e69..faaa28d 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -11315,13 +11315,13 @@ public class WindowManagerService extends IWindowManager.Stub mInputMonitor.thawInputDispatchingLw(); + boolean configChanged; + // While the display is frozen we don't re-compute the orientation // to avoid inconsistent states. However, something interesting // could have actually changed during that time so re-evaluate it // now to catch that. - if (updateOrientationFromAppTokensLocked(false)) { - mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION); - } + configChanged = updateOrientationFromAppTokensLocked(false); // A little kludge: a lot could have happened while the // display was frozen, so now that we are coming back we @@ -11336,11 +11336,12 @@ public class WindowManagerService extends IWindowManager.Stub if (updateRotation) { if (DEBUG_ORIENTATION) Slog.d(TAG, "Performing post-rotate rotation"); - boolean changed = setRotationUncheckedLocked( + configChanged |= setRotationUncheckedLocked( WindowManagerPolicy.USE_LAST_ROTATION, 0, false); - if (changed) { - sendNewConfiguration(); - } + } + + if (configChanged) { + mH.sendEmptyMessage(H.SEND_NEW_CONFIGURATION); } } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 5fd946e..13665e1 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -70,6 +70,12 @@ public class StatusBarTest extends TestActivity } private Test[] mTests = new Test[] { + new Test("DISABLE_NAVIGATION") { + public void run() { + View v = findViewById(android.R.id.list); + v.setSystemUiVisibility(View.STATUS_BAR_DISABLE_NAVIGATION); + } + }, new Test("STATUS_BAR_HIDDEN") { public void run() { View v = findViewById(android.R.id.list); @@ -77,7 +83,7 @@ public class StatusBarTest extends TestActivity v.setOnSystemUiVisibilityChangeListener(mOnSystemUiVisibilityChangeListener); } }, - new Test("not STATUS_BAR_HIDDEN") { + new Test("no setSystemUiVisibility") { public void run() { View v = findViewById(android.R.id.list); v.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); diff --git a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java index 7a0c2f7..38c092d 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java @@ -95,7 +95,7 @@ public abstract class Gradient_Delegate extends Shader_Delegate { * Pre-computes the colors for the gradient. This must be called once before any call * to {@link #getGradientColor(float)} */ - protected synchronized void precomputeGradientColors() { + protected void precomputeGradientColors() { if (mGradient == null) { // actually create an array with an extra size, so that we can really go // from 0 to SIZE (100%), or currentPos in the loop below will never equal 1.0 diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java index bd52dc2..0ed4305 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java @@ -28,6 +28,7 @@ import com.android.layoutlib.bridge.android.BridgeAssetManager; import com.android.layoutlib.bridge.impl.FontLoader; import com.android.layoutlib.bridge.impl.RenderSessionImpl; import com.android.ninepatch.NinePatchChunk; +import com.android.resources.ResourceType; import com.android.tools.layoutlib.create.MethodAdapter; import com.android.tools.layoutlib.create.OverrideMethod; @@ -410,8 +411,9 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge { * @param name the name of the resource. * @return an {@link Integer} containing the resource id, or null if no resource were found. */ - public static Integer getResourceValue(String type, String name) { - Map<String, Integer> map = sRFullMap.get(type); + public static Integer getResourceValue(ResourceType type, String name) { + String typeString = type.getName(); + Map<String, Integer> map = sRFullMap.get(typeString); if (map != null) { return map.get(name); } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java index 79264d0..abea8c7 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java @@ -24,6 +24,7 @@ import com.android.ide.common.rendering.api.StyleResourceValue; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; import com.android.layoutlib.bridge.impl.Stack; +import com.android.resources.ResourceType; import android.app.Activity; import android.app.Fragment; @@ -614,7 +615,7 @@ public final class BridgeContext extends Activity { return null; } - int getFrameworkResourceValue(String resType, String resName, int defValue) { + int getFrameworkResourceValue(ResourceType resType, String resName, int defValue) { Integer value = Bridge.getResourceValue(resType, resName); if (value != null) { return value.intValue(); @@ -623,7 +624,7 @@ public final class BridgeContext extends Activity { return defValue; } - int getProjectResourceValue(String resType, String resName, int defValue) { + int getProjectResourceValue(ResourceType resType, String resName, int defValue) { if (mProjectCallback != null) { Integer value = mProjectCallback.getResourceValue(resType, resName); if (value != null) { diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java index 465bf1d..edc92c2 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeInflater.java @@ -19,9 +19,9 @@ package com.android.layoutlib.bridge.android; import com.android.ide.common.rendering.api.IProjectCallback; import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.MergeCookie; -import com.android.ide.common.rendering.api.RenderResources; import com.android.ide.common.rendering.api.ResourceValue; import com.android.layoutlib.bridge.Bridge; +import com.android.resources.ResourceType; import org.kxml2.io.KXmlParser; import org.xmlpull.v1.XmlPullParser; @@ -158,13 +158,13 @@ public final class BridgeInflater extends LayoutInflater { String[] layoutInfo = Bridge.resolveResourceValue(resource); if (layoutInfo != null) { value = bridgeContext.getRenderResources().getFrameworkResource( - RenderResources.RES_LAYOUT, layoutInfo[0]); + ResourceType.LAYOUT, layoutInfo[0]); } else { layoutInfo = mProjectCallback.resolveResourceValue(resource); if (layoutInfo != null) { value = bridgeContext.getRenderResources().getProjectResource( - RenderResources.RES_LAYOUT, layoutInfo[0]); + ResourceType.LAYOUT, layoutInfo[0]); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java index 7b66809..e71bbb2 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java @@ -22,6 +22,7 @@ import com.android.ide.common.rendering.api.ResourceValue; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; import com.android.layoutlib.bridge.impl.ResourceHelper; +import com.android.resources.ResourceType; import org.kxml2.io.KXmlParser; import org.xmlpull.v1.XmlPullParser; @@ -103,9 +104,14 @@ public final class BridgeResources extends Resources { String[] resourceInfo = Bridge.resolveResourceValue(id); if (resourceInfo != null) { + ResourceType resType = ResourceType.getEnum(resourceInfo[1]); + if (resType == null) { + return null; + } + platformResFlag_out[0] = true; return mContext.getRenderResources().getFrameworkResource( - resourceInfo[1], resourceInfo[0]); + resType, resourceInfo[0]); } // didn't find a match in the framework? look in the project. @@ -113,9 +119,14 @@ public final class BridgeResources extends Resources { resourceInfo = mProjectCallback.resolveResourceValue(id); if (resourceInfo != null) { + ResourceType resType = ResourceType.getEnum(resourceInfo[1]); + if (resType == null) { + return null; + } + platformResFlag_out[0] = false; return mContext.getRenderResources().getProjectResource( - resourceInfo[1], resourceInfo[0]); + resType, resourceInfo[0]); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java index 8d3c929..2b48539 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java @@ -24,6 +24,7 @@ import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; import com.android.layoutlib.bridge.impl.ResourceHelper; +import com.android.resources.ResourceType; import org.kxml2.io.KXmlParser; import org.xmlpull.v1.XmlPullParser; @@ -39,6 +40,7 @@ import android.view.ViewGroup.LayoutParams; import java.io.File; import java.io.FileReader; +import java.util.Arrays; import java.util.Map; /** @@ -587,17 +589,17 @@ public final class BridgeTypedArray extends TypedArray { // then the xml attribute value was "resolved" which leads us to a ResourceValue with a // valid getType() and getName() returning a resource name. // (and getValue() returning null!). We need to handle this! - if (resValue.getType() != null && resValue.getType().startsWith("@+") == false) { + if (resValue.getResourceType() != null && resValue.getType().startsWith("@+") == false) { // if this is a framework id if (mPlatformFile || resValue.isFramework()) { // look for idName in the android R classes return mContext.getFrameworkResourceValue( - resValue.getType(), resValue.getName(), defValue); + resValue.getResourceType(), resValue.getName(), defValue); } // look for idName in the project R class. return mContext.getProjectResourceValue( - resValue.getType(), resValue.getName(), defValue); + resValue.getResourceType(), resValue.getName(), defValue); } // else, try to get the value, and resolve it somehow. @@ -634,21 +636,22 @@ public final class BridgeTypedArray extends TypedArray { // if this is a framework id if (mPlatformFile || value.startsWith("@android") || value.startsWith("@+android")) { // look for idName in the android R classes - return mContext.getFrameworkResourceValue(RenderResources.RES_ID, idName, defValue); + return mContext.getFrameworkResourceValue(ResourceType.ID, idName, defValue); } // look for idName in the project R class. - return mContext.getProjectResourceValue(RenderResources.RES_ID, idName, defValue); + return mContext.getProjectResourceValue(ResourceType.ID, idName, defValue); } // not a direct id valid reference? resolve it Integer idValue = null; if (resValue.isFramework()) { - idValue = Bridge.getResourceValue(resValue.getType(), resValue.getName()); + idValue = Bridge.getResourceValue(resValue.getResourceType(), + resValue.getName()); } else { idValue = mContext.getProjectCallback().getResourceValue( - resValue.getType(), resValue.getName()); + resValue.getResourceType(), resValue.getName()); } if (idValue != null) { @@ -796,6 +799,6 @@ public final class BridgeTypedArray extends TypedArray { @Override public String toString() { - return mResourceData.toString(); + return Arrays.toString(mResourceData); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java index 4a6880b..f39961e 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeXmlPullAttributes.java @@ -20,6 +20,7 @@ import com.android.ide.common.rendering.api.RenderResources; import com.android.ide.common.rendering.api.ResourceValue; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; +import com.android.resources.ResourceType; import org.xmlpull.v1.XmlPullParser; @@ -58,7 +59,7 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { String ns = mParser.getAttributeNamespace(index); if (BridgeConstants.NS_RESOURCES.equals(ns)) { - Integer v = Bridge.getResourceValue(RenderResources.RES_ATTR, name); + Integer v = Bridge.getResourceValue(ResourceType.ATTR, name); if (v != null) { return v.intValue(); } @@ -69,7 +70,7 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { // this is not an attribute in the android namespace, we query the customviewloader, if // the namespaces match. if (mContext.getProjectCallback().getNamespace().equals(ns)) { - Integer v = mContext.getProjectCallback().getResourceValue(RenderResources.RES_ATTR, + Integer v = mContext.getProjectCallback().getResourceValue(ResourceType.ATTR, name); if (v != null) { return v.intValue(); @@ -110,10 +111,10 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { if (resource != null) { Integer id = null; if (mPlatformFile || resource.isFramework()) { - id = Bridge.getResourceValue(resource.getType(), resource.getName()); + id = Bridge.getResourceValue(resource.getResourceType(), resource.getName()); } else { id = mContext.getProjectCallback().getResourceValue( - resource.getType(), resource.getName()); + resource.getResourceType(), resource.getName()); } if (id != null) { diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java index 5d56370..f62fad2 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/FontLoader.java @@ -163,7 +163,7 @@ public final class FontLoader { mTtfToFontMap.put(ttf, styleMap); } - Font f = styleMap.get(style); + Font f = styleMap.get(style[0]); if (f != null) { return f; diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index 978832f..19251f9 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -48,6 +48,7 @@ import com.android.layoutlib.bridge.android.BridgeWindow; import com.android.layoutlib.bridge.android.BridgeWindowSession; import com.android.layoutlib.bridge.android.BridgeXmlBlockParser; import com.android.resources.Density; +import com.android.resources.ResourceType; import com.android.resources.ScreenSize; import android.animation.Animator; @@ -566,17 +567,16 @@ public class RenderSessionImpl extends FrameworkResourceIdProvider { int animationId = 0; if (isFrameworkAnimation) { animationResource = mContext.getRenderResources().getFrameworkResource( - RenderResources.RES_ANIMATOR, animationName); + ResourceType.ANIMATOR, animationName); if (animationResource != null) { - animationId = Bridge.getResourceValue(RenderResources.RES_ANIMATOR, - animationName); + animationId = Bridge.getResourceValue(ResourceType.ANIMATOR, animationName); } } else { animationResource = mContext.getRenderResources().getProjectResource( - RenderResources.RES_ANIMATOR, animationName); + ResourceType.ANIMATOR, animationName); if (animationResource != null) { animationId = mContext.getProjectCallback().getResourceValue( - RenderResources.RES_ANIMATOR, animationName); + ResourceType.ANIMATOR, animationName); } } @@ -1022,7 +1022,7 @@ public class RenderSessionImpl extends FrameworkResourceIdProvider { mStatusBarSize = DEFAULT_STATUS_BAR_HEIGHT; // get the real value - ResourceValue value = resources.getFrameworkResource(RenderResources.RES_DIMEN, + ResourceValue value = resources.getFrameworkResource(ResourceType.DIMEN, "status_bar_height"); if (value != null) { @@ -1110,7 +1110,7 @@ public class RenderSessionImpl extends FrameworkResourceIdProvider { mSystemBarSize = 56; // ?? // get the real value - ResourceValue value = resources.getFrameworkResource(RenderResources.RES_DIMEN, + ResourceValue value = resources.getFrameworkResource(ResourceType.DIMEN, "status_bar_height"); if (value != null) { @@ -1309,7 +1309,7 @@ public class RenderSessionImpl extends FrameworkResourceIdProvider { // --- FrameworkResourceIdProvider methods @Override - public Integer getId(String resType, String resName) { + public Integer getId(ResourceType resType, String resName) { return Bridge.getResourceValue(resType, resName); } } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index 119dfb1..ae7a77f 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -298,7 +298,7 @@ public final class ResourceHelper { */ public static boolean stringToFloat(String s, TypedValue outValue) { // remove the space before and after - s.trim(); + s = s.trim(); int len = s.length(); if (len <= 0) { |