diff options
43 files changed, 997 insertions, 418 deletions
diff --git a/core/java/android/text/TextUtils.java b/core/java/android/text/TextUtils.java index 95a3cdc..43dfc81 100644 --- a/core/java/android/text/TextUtils.java +++ b/core/java/android/text/TextUtils.java @@ -1325,7 +1325,11 @@ public class TextUtils { sb.append("&"); //$NON-NLS-1$ break; case '\'': - sb.append("'"); //$NON-NLS-1$ + //http://www.w3.org/TR/xhtml1 + // The named character reference ' (the apostrophe, U+0027) was introduced in + // XML 1.0 but does not appear in HTML. Authors should therefore use ' instead + // of ' to work as expected in HTML 4 user agents. + sb.append("'"); //$NON-NLS-1$ break; case '"': sb.append("""); //$NON-NLS-1$ diff --git a/core/java/android/view/ActionMode.java b/core/java/android/view/ActionMode.java index 0349a2b..c1c7fe2 100644 --- a/core/java/android/view/ActionMode.java +++ b/core/java/android/view/ActionMode.java @@ -24,7 +24,7 @@ package android.view; * <div class="special reference"> * <h3>Developer Guides</h3> * <p>For information about how to provide contextual actions with {@code ActionMode}, - * read the <a href="{@docRoot}guide/topics/ui/menu.html#context-menu">Menus</a> + * read the <a href="{@docRoot}guide/topics/ui/menus.html#context-menu">Menus</a> * developer guide.</p> * </div> */ diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java index ccb6489..71f3cf5 100644 --- a/core/java/android/view/HardwareRenderer.java +++ b/core/java/android/view/HardwareRenderer.java @@ -811,6 +811,8 @@ public abstract class HardwareRenderer { if (canDraw()) { if (!hasDirtyRegions()) { dirty = null; + } else if (dirty != null) { + dirty.intersect(0, 0, mWidth, mHeight); } attachInfo.mIgnoreDirtyState = true; attachInfo.mDrawingTime = SystemClock.uptimeMillis(); diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index b41e6f5..ce36046 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -26,7 +26,6 @@ import com.android.internal.view.IInputMethodSession; import com.android.internal.view.InputBindResult; import android.content.Context; -import android.content.pm.PackageManager; import android.graphics.Rect; import android.os.Bundle; import android.os.Handler; @@ -198,7 +197,31 @@ public final class InputMethodManager { static final Object mInstanceSync = new Object(); static InputMethodManager mInstance; - + + /** + * @hide Flag for IInputMethodManager.windowGainedFocus: a view in + * the window has input focus. + */ + public static final int CONTROL_WINDOW_VIEW_HAS_FOCUS = 1<<0; + + /** + * @hide Flag for IInputMethodManager.windowGainedFocus: the focus + * is a text editor. + */ + public static final int CONTROL_WINDOW_IS_TEXT_EDITOR = 1<<1; + + /** + * @hide Flag for IInputMethodManager.windowGainedFocus: this is the first + * time the window has gotten focus. + */ + public static final int CONTROL_WINDOW_FIRST = 1<<2; + + /** + * @hide Flag for IInputMethodManager.startInput: this is the first + * time the window has gotten focus. + */ + public static final int CONTROL_START_INITIAL = 1<<8; + final IInputMethodManager mService; final Looper mMainLooper; @@ -216,7 +239,7 @@ public final class InputMethodManager { /** * Set whenever this client becomes inactive, to know we need to reset - * state with the IME then next time we receive focus. + * state with the IME the next time we receive focus. */ boolean mHasBeenInactive = true; @@ -243,11 +266,6 @@ public final class InputMethodManager { */ View mNextServedView; /** - * True if we should restart input in the next served view, even if the - * view hasn't actually changed from the current serve view. - */ - boolean mNextServedNeedsStart; - /** * This is set when we are in the process of connecting, to determine * when we have actually finished. */ @@ -331,11 +349,12 @@ public final class InputMethodManager { mCurId = res.id; mBindSequence = res.sequence; } - startInputInner(); + startInputInner(null, 0, 0, 0); return; } case MSG_UNBIND: { final int sequence = msg.arg1; + boolean startInput = false; synchronized (mH) { if (mBindSequence == sequence) { if (false) { @@ -355,8 +374,13 @@ public final class InputMethodManager { if (mServedView != null && mServedView.isFocused()) { mServedConnecting = true; } + if (mActive) { + startInput = true; + } } - startInputInner(); + } + if (startInput) { + startInputInner(null, 0, 0, 0); } return; } @@ -946,10 +970,11 @@ public final class InputMethodManager { mServedConnecting = true; } - startInputInner(); + startInputInner(null, 0, 0, 0); } - void startInputInner() { + boolean startInputInner(IBinder windowGainingFocus, int controlFlags, int softInputMode, + int windowFlags) { final View view; synchronized (mH) { view = mServedView; @@ -958,7 +983,7 @@ public final class InputMethodManager { if (DEBUG) Log.v(TAG, "Starting input: view=" + view); if (view == null) { if (DEBUG) Log.v(TAG, "ABORT input: no served view!"); - return; + return false; } } @@ -971,7 +996,7 @@ public final class InputMethodManager { // If the view doesn't have a handler, something has changed out // from under us, so just bail. if (DEBUG) Log.v(TAG, "ABORT input: no handler for view!"); - return; + return false; } if (vh.getLooper() != Looper.myLooper()) { // The view is running on a different thread than our own, so @@ -979,10 +1004,10 @@ public final class InputMethodManager { if (DEBUG) Log.v(TAG, "Starting input: reschedule to view thread"); vh.post(new Runnable() { public void run() { - startInputInner(); + startInputInner(null, 0, 0, 0); } }); - return; + return false; } // Okay we are now ready to call into the served view and have it @@ -1002,12 +1027,14 @@ public final class InputMethodManager { if (DEBUG) Log.v(TAG, "Starting input: finished by someone else (view=" + mServedView + " conn=" + mServedConnecting + ")"); - return; + return false; } - + // If we already have a text box, then this view is already // connected so we want to restart it. - final boolean initial = mCurrentTextBoxAttribute == null; + if (mCurrentTextBoxAttribute == null) { + controlFlags |= CONTROL_START_INITIAL; + } // Hook 'em up and let 'er rip. mCurrentTextBoxAttribute = tba; @@ -1027,9 +1054,17 @@ public final class InputMethodManager { try { if (DEBUG) Log.v(TAG, "START INPUT: " + view + " ic=" - + ic + " tba=" + tba + " initial=" + initial); - InputBindResult res = mService.startInput(mClient, - servedContext, tba, initial, true); + + ic + " tba=" + tba + " controlFlags=#" + + Integer.toHexString(controlFlags)); + InputBindResult res; + if (windowGainingFocus != null) { + res = mService.windowGainedFocus(mClient, windowGainingFocus, + controlFlags, softInputMode, windowFlags, + tba, servedContext); + } else { + res = mService.startInput(mClient, + servedContext, tba, controlFlags); + } if (DEBUG) Log.v(TAG, "Starting input: Bind result=" + res); if (res != null) { if (res.id != null) { @@ -1038,7 +1073,7 @@ public final class InputMethodManager { } else if (mCurMethod == null) { // This means there is no input method available. if (DEBUG) Log.v(TAG, "ABORT input: no input method!"); - return; + return true; } } if (mCurMethod != null && mCompletions != null) { @@ -1051,6 +1086,8 @@ public final class InputMethodManager { Log.w(TAG, "IME died: " + mCurId, e); } } + + return true; } /** @@ -1127,43 +1164,48 @@ public final class InputMethodManager { * @hide */ public void checkFocus() { + if (checkFocusNoStartInput(false)) { + startInputInner(null, 0, 0, 0); + } + } + + private boolean checkFocusNoStartInput(boolean forceNewFocus) { // This is called a lot, so short-circuit before locking. - if (mServedView == mNextServedView && !mNextServedNeedsStart) { - return; + if (mServedView == mNextServedView && !forceNewFocus) { + return false; } InputConnection ic = null; synchronized (mH) { - if (mServedView == mNextServedView && !mNextServedNeedsStart) { - return; + if (mServedView == mNextServedView && !forceNewFocus) { + return false; } if (DEBUG) Log.v(TAG, "checkFocus: view=" + mServedView + " next=" + mNextServedView - + " restart=" + mNextServedNeedsStart); - - mNextServedNeedsStart = false; + + " forceNewFocus=" + forceNewFocus); + if (mNextServedView == null) { finishInputLocked(); // In this case, we used to have a focused view on the window, // but no longer do. We should make sure the input method is // no longer shown, since it serves no purpose. closeCurrentInput(); - return; + return false; } - + ic = mServedInputConnection; - + mServedView = mNextServedView; mCurrentTextBoxAttribute = null; mCompletions = null; mServedConnecting = true; } - + if (ic != null) { ic.finishComposingText(); } - - startInputInner(); + + return true; } void closeCurrentInput() { @@ -1172,13 +1214,14 @@ public final class InputMethodManager { } catch (RemoteException e) { } } - + /** * Called by ViewAncestor when its window gets input focus. * @hide */ public void onWindowFocus(View rootView, View focusedView, int softInputMode, boolean first, int windowFlags) { + boolean forceNewFocus = false; synchronized (mH) { if (DEBUG) Log.v(TAG, "onWindowFocus: " + focusedView + " softInputMode=" + softInputMode @@ -1187,20 +1230,39 @@ public final class InputMethodManager { if (mHasBeenInactive) { if (DEBUG) Log.v(TAG, "Has been inactive! Starting fresh"); mHasBeenInactive = false; - mNextServedNeedsStart = true; + forceNewFocus = true; } focusInLocked(focusedView != null ? focusedView : rootView); } + + int controlFlags = 0; + if (focusedView != null) { + controlFlags |= CONTROL_WINDOW_VIEW_HAS_FOCUS; + if (focusedView.onCheckIsTextEditor()) { + controlFlags |= CONTROL_WINDOW_IS_TEXT_EDITOR; + } + } + if (first) { + controlFlags |= CONTROL_WINDOW_FIRST; + } - checkFocus(); + if (checkFocusNoStartInput(forceNewFocus)) { + // We need to restart input on the current focus view. This + // should be done in conjunction with telling the system service + // about the window gaining focus, to help make the transition + // smooth. + if (startInputInner(rootView.getWindowToken(), + controlFlags, softInputMode, windowFlags)) { + return; + } + } + // For some reason we didn't do a startInput + windowFocusGain, so + // we'll just do a window focus gain and call it a day. synchronized (mH) { try { - final boolean isTextEditor = focusedView != null && - focusedView.onCheckIsTextEditor(); mService.windowGainedFocus(mClient, rootView.getWindowToken(), - focusedView != null, isTextEditor, softInputMode, first, - windowFlags); + controlFlags, softInputMode, windowFlags, null, null); } catch (RemoteException e) { } } @@ -1633,8 +1695,7 @@ public final class InputMethodManager { p.println(" mCurMethod=" + mCurMethod); p.println(" mCurRootView=" + mCurRootView); p.println(" mServedView=" + mServedView); - p.println(" mNextServedNeedsStart=" + mNextServedNeedsStart - + " mNextServedView=" + mNextServedView); + p.println(" mNextServedView=" + mNextServedView); p.println(" mServedConnecting=" + mServedConnecting); if (mCurrentTextBoxAttribute != null) { p.println(" mCurrentTextBoxAttribute:"); diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index 683aca5..714d8ba 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -43,16 +43,17 @@ interface IInputMethodManager { void removeClient(in IInputMethodClient client); InputBindResult startInput(in IInputMethodClient client, - IInputContext inputContext, in EditorInfo attribute, - boolean initial, boolean needResult); + IInputContext inputContext, in EditorInfo attribute, int controlFlags); void finishInput(in IInputMethodClient client); boolean showSoftInput(in IInputMethodClient client, int flags, in ResultReceiver resultReceiver); boolean hideSoftInput(in IInputMethodClient client, int flags, in ResultReceiver resultReceiver); - void windowGainedFocus(in IInputMethodClient client, in IBinder windowToken, - boolean viewHasFocus, boolean isTextEditor, - int softInputMode, boolean first, int windowFlags); + // Report that a window has gained focus. If 'attribute' is non-null, + // this will also do a startInput. + InputBindResult windowGainedFocus(in IInputMethodClient client, in IBinder windowToken, + int controlFlags, int softInputMode, int windowFlags, + in EditorInfo attribute, IInputContext inputContext); void showInputMethodPickerFromClient(in IInputMethodClient client); void showInputMethodAndSubtypeEnablerFromClient(in IInputMethodClient client, String topId); diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java index ed02636..fa16527 100644 --- a/core/java/com/android/internal/widget/ActionBarContextView.java +++ b/core/java/com/android/internal/widget/ActionBarContextView.java @@ -405,8 +405,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi View child = mMenuView.getChildAt(i); child.setScaleY(0); ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0, 1); - a.setDuration(100); - a.setStartDelay(j * 70); + a.setDuration(300); b.with(a); } } @@ -432,8 +431,7 @@ public class ActionBarContextView extends AbsActionBarView implements AnimatorLi View child = mMenuView.getChildAt(i); child.setScaleY(0); ObjectAnimator a = ObjectAnimator.ofFloat(child, "scaleY", 0); - a.setDuration(100); - a.setStartDelay(i * 70); + a.setDuration(300); b.with(a); } } diff --git a/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_3_fully.png b/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_3_fully.png Binary files differindex c2e4b78..cb08eed 100644 --- a/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_3_fully.png +++ b/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_3_fully.png diff --git a/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_disconnected.png b/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_disconnected.png Binary files differindex 51b839f..ea065c3 100644 --- a/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_disconnected.png +++ b/core/res/res/drawable-hdpi/stat_sys_data_wimax_signal_disconnected.png diff --git a/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_3_fully.png b/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_3_fully.png Binary files differnew file mode 100644 index 0000000..d3ba98c --- /dev/null +++ b/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_3_fully.png diff --git a/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_disconnected.png b/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_disconnected.png Binary files differnew file mode 100644 index 0000000..153c6ad --- /dev/null +++ b/core/res/res/drawable-mdpi/stat_sys_data_wimax_signal_disconnected.png diff --git a/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_3_fully.png b/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_3_fully.png Binary files differnew file mode 100644 index 0000000..ec6bc54 --- /dev/null +++ b/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_3_fully.png diff --git a/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_disconnected.png b/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_disconnected.png Binary files differnew file mode 100644 index 0000000..9fd4f33 --- /dev/null +++ b/core/res/res/drawable-xhdpi/stat_sys_data_wimax_signal_disconnected.png diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 5eb09e6..37a8edb 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -227,6 +227,13 @@ <item>4</item> </integer-array> + <!-- If the DUN connection for this CDMA device supports more than just DUN --> + <!-- traffic you should list them here. --> + <!-- If this device is not CDMA this is ignored. If this list is empty on --> + <!-- a DUN-requiring CDMA device, the DUN APN will just support just DUN. --> + <string-array translatable="false" name="config_cdma_dun_supported_types"> + </string-array> + <!-- String containing the apn value for tethering. May be overriden by secure settings TETHER_DUN_APN. Value is a comma separated series of strings: "name,apn,proxy,port,username,password,server,mmsc,mmsproxy,mmsport,mcc,mnc,auth,type" diff --git a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java index a781472..76b702e 100644 --- a/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java +++ b/core/tests/bandwidthtests/src/com/android/bandwidthtest/BandwidthTest.java @@ -90,6 +90,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiDownload() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue("Could not connect to wifi!", setDeviceWifiAndAirplaneMode(mSsid)); downloadFile(); } @@ -143,6 +144,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiUpload() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue(setDeviceWifiAndAirplaneMode(mSsid)); uploadFile(); } @@ -197,6 +199,7 @@ public class BandwidthTest extends InstrumentationTestCase { */ @LargeTest public void testWifiDownloadWithDownloadManager() throws Exception { + mConnectionUtil.wifiTestInit(); assertTrue(setDeviceWifiAndAirplaneMode(mSsid)); downloadFileUsingDownloadManager(); } @@ -286,6 +289,8 @@ public class BandwidthTest extends InstrumentationTestCase { * @return true if we successfully connect to mobile data. */ public boolean hasMobileData() { + assertTrue(mConnectionUtil.waitForNetworkState(ConnectivityManager.TYPE_MOBILE, + State.CONNECTED, ConnectionUtil.LONG_TIMEOUT)); assertTrue("Not connected to mobile", mConnectionUtil.isConnectedToMobile()); assertFalse("Still connected to wifi.", mConnectionUtil.isConnectedToWifi()); return mConnectionUtil.hasData(); diff --git a/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java b/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java index a5e5ab0..8d778c4 100644 --- a/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java +++ b/core/tests/bandwidthtests/src/com/android/bandwidthtest/util/ConnectionUtil.java @@ -44,6 +44,8 @@ import com.android.bandwidthtest.NetworkState; import com.android.bandwidthtest.NetworkState.StateTransitionDirection; import com.android.internal.util.AsyncChannel; +import junit.framework.Assert; + import java.io.IOException; import java.net.UnknownHostException; import java.util.List; @@ -57,7 +59,7 @@ public class ConnectionUtil { private static final int WAIT_FOR_SCAN_RESULT = 10 * 1000; // 10 seconds private static final int WIFI_SCAN_TIMEOUT = 50 * 1000; public static final int SHORT_TIMEOUT = 5 * 1000; - public static final int LONG_TIMEOUT = 10 * 1000; + public static final int LONG_TIMEOUT = 120 * 1000; // 2 minutes private ConnectivityReceiver mConnectivityReceiver = null; private WifiReceiver mWifiReceiver = null; private DownloadReceiver mDownloadReceiver = null; @@ -118,8 +120,14 @@ public class ConnectionUtil { initializeNetworkStates(); - mWifiManager.setWifiEnabled(true); + } + + /** + * Additional initialization needed for wifi related tests. + */ + public void wifiTestInit() { + mWifiManager.setWifiEnabled(true); Log.v(LOG_TAG, "Clear Wifi before we start the test."); sleep(SHORT_TIMEOUT); removeConfiguredNetworksAndDisableWifi(); @@ -146,10 +154,10 @@ public class ConnectionUtil { Log.v("ConnectivityReceiver", "onReceive() called with " + intent); return; } - if (intent.hasExtra(ConnectivityManager.EXTRA_NETWORK_INFO)) { - mNetworkInfo = (NetworkInfo) - intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); - } + + final ConnectivityManager connManager = (ConnectivityManager) context + .getSystemService(Context.CONNECTIVITY_SERVICE); + mNetworkInfo = connManager.getActiveNetworkInfo(); if (intent.hasExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO)) { mOtherNetworkInfo = (NetworkInfo) @@ -447,6 +455,11 @@ public class ConnectionUtil { } catch (InterruptedException e) { e.printStackTrace(); } + if (mNetworkInfo == null) { + Log.v(LOG_TAG, "Do not have networkInfo! Force fetch of network info."); + mNetworkInfo = mCM.getActiveNetworkInfo(); + Assert.assertNotNull(mNetworkInfo); + } if ((mNetworkInfo.getType() != networkType) || (mNetworkInfo.getState() != expectedState)) { Log.v(LOG_TAG, "network state for " + mNetworkInfo.getType() + @@ -525,7 +538,7 @@ public class ConnectionUtil { /** * Connect to Wi-Fi with the given configuration. * @param config - * @return true if we ar connected to a given + * @return true if we are connected to a given AP. */ public boolean connectToWifiWithConfiguration(WifiConfiguration config) { // The SSID in the configuration is a pure string, need to convert it to a quoted string. diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd index d390ec1..d22dca1 100644 --- a/docs/html/guide/developing/device.jd +++ b/docs/html/guide/developing/device.jd @@ -51,19 +51,13 @@ would on the emulator. Before you can start, there are just a few things to do:< <ol> <li>Declare your application as "debuggable" in your Android Manifest. - <p>In Eclipse, you can do this from the <b>Application</b> tab when viewing the Manifest - (on the right side, set <b>Debuggable</b> to <em>true</em>). Otherwise, in the -<code>AndroidManifest.xml</code> - file, add <code>android:debuggable="true"</code> to the <code><application></code> -element.</p> - </li> - <li>Set up your device to allow installation of non-Market applications. <p>On -the device, go to <strong>Settings > Applications</strong> and enable - -<strong>Unknown sources</strong> (on an Android 4.0 device, the setting is -located in <strong>Settings > Security</strong>).</p> - - </li> + <p>When using Eclipse, you can skip this step, because running your app directly from +the Eclipse IDE automatically enables debugging.</p> + <p>In the <code>AndroidManifest.xml</code> file, add <code>android:debuggable="true"</code> to +the <code><application></code> element.</p> + <p class="note"><strong>Note:</strong> If you manually enable debugging in the manifest + file, be sure to disable it before you build for release (your published application +should usually <em>not</em> be debuggable).</p></li> <li>Turn on "USB Debugging" on your device. <p>On the device, go to <strong>Settings > Applications > Development</strong> and enable <strong>USB debugging</strong> @@ -72,13 +66,10 @@ located in <strong>Settings > Developer options</strong>).</p> </li> <li>Set up your system to detect your device. <ul> - <li>If you're developing on Windows, you need to install a USB driver - for adb. If you're using an Android Developer Phone (ADP), Nexus One, or Nexus S, - see the <a href="{@docRoot}sdk/win-usb.html">Google Windows USB - Driver</a>. Otherwise, you can find a link to the appropriate OEM driver in the - <a href="{@docRoot}sdk/oem-usb.html">OEM USB Drivers</a> document.</li> + <li>If you're developing on Windows, you need to install a USB driver for adb. For an +installation guide and links to OEM drivers, see the <a href="{@docRoot}sdk/oem-usb.html">OEM USB +Drivers</a> document.</li> <li>If you're developing on Mac OS X, it just works. Skip this step.</li> - <li>If you're developing on Ubuntu Linux, you need to add a <code>udev</code> rules file that contains a USB configuration for each type of device you want to use for development. In the rules file, each device manufacturer @@ -114,7 +105,7 @@ rules</a>.</p> </li> </ol> -<p>You can verify that your device is connected by executing <code>adb +<p>When plugged in over USB, can verify that your device is connected by executing <code>adb devices</code> from your SDK {@code platform-tools/} directory. If connected, you'll see the device name listed as a "device."</p> diff --git a/docs/html/images/training/lint_icon.png b/docs/html/images/training/lint_icon.png Binary files differnew file mode 100644 index 0000000..118a741 --- /dev/null +++ b/docs/html/images/training/lint_icon.png diff --git a/docs/html/index.jd b/docs/html/index.jd index b9d6758..431a7d2 100644 --- a/docs/html/index.jd +++ b/docs/html/index.jd @@ -154,7 +154,7 @@ href="{@docRoot}resources/dashboard/platform-versions.html">Learn more »</ + "href='https://plus.google.com/108967384991768947849'>+Android Developers</a>. " + "We'll use it to host Hangouts for developers, talk about the latest releases, " + "development and design tips, and much more.</p>" -+ "<div style='margin:.7em 0 0 -1.2em'><g:plus href='https://plus.google.com/108967384991768947849' " ++ "<div style='margin:.7em 0 0 0'><g:plus href='https://plus.google.com/108967384991768947849' " + "size=\"smallbadge\" width=\"275\"></g:plus></div>" }, diff --git a/docs/html/sdk/ndk/index.jd b/docs/html/sdk/ndk/index.jd index afbad57..29f0749 100644 --- a/docs/html/sdk/ndk/index.jd +++ b/docs/html/sdk/ndk/index.jd @@ -1,16 +1,16 @@ ndk=true -ndk.win_download=android-ndk-r7-windows.zip -ndk.win_bytes=81270552 -ndk.win_checksum=55483482cf2b75e8dd1a5d9a7caeb6e5 +ndk.win_download=android-ndk-r7b-windows.zip +ndk.win_bytes=80346206 +ndk.win_checksum=c42b0c9c14428397337421d5e4999380 -ndk.mac_download=android-ndk-r7-darwin-x86.tar.bz2 -ndk.mac_bytes=71262092 -ndk.mac_checksum=817ca5675a1dd44078098e43070f19b6 +ndk.mac_download=android-ndk-r7b-darwin-x86.tar.bz2 +ndk.mac_bytes=73817184 +ndk.mac_checksum=6daa82ca6b73bc0614c9997430079c7a -ndk.linux_download=android-ndk-r7-linux-x86.tar.bz2 -ndk.linux_bytes=64884365 -ndk.linux_checksum=bf15e6b47bf50824c4b96849bf003ca3 +ndk.linux_download=android-ndk-r7b-linux-x86.tar.bz2 +ndk.linux_bytes=64349733 +ndk.linux_checksum=0eb8af18796cdaa082df8f7c54ad7f9a page.title=Android NDK @@ -62,6 +62,116 @@ padding: .25em 1em; <div class="toggleable open"> <a href="#" onclick="return toggleDiv(this)"><img src= "{@docRoot}assets/images/triangle-opened.png" class="toggle-img" height="9px" width="9px"> + Android NDK, Revision 7b</a> <em>(February 2012)</em> + + <div class="toggleme"> + <p>This release of the NDK includes fixes for native Windows builds, Cygwin and many other + improvements:</p> + + <dl> + <dt>Important bug fixes:</dt> + + <dd> + <ul> + <li>Updated {@code sys/atomics.h} to avoid correctness issues + on some multi-core ARM-based devices. Rebuild your unmodified sources with this + version of the NDK and this problem should be completely eliminated. + For more details, read {@code docs/ANDROID-ATOMICS.html}.</li> + <li>Reverted to {@code binutils} 2.19 to fix debugging issues that + appeared in NDK r7 (which switched to {@code binutils} 2.20.1).</li> + <li>Fixed {@code ndk-build} on 32-bit Linux. A packaging error put a 64-bit version + of the {@code awk} executable under {@code prebuilt/linux-x86/bin} in NDK r7.</li> + <li>Fixed native Windows build ({@code ndk-build.cmd}). Other build modes were not + affected. The fixes include: + <ul> + <li>Removed an infinite loop / stack overflow bug that happened when trying + to call {@code ndk-build.cmd} from a directory that was <em>not</em> the top of + your project path (e.g., in any sub-directory of it).</li> + <li>Fixed a problem where the auto-generated dependency files were ignored. This + meant that updating a header didn't trigger recompilation of sources that included + it.</li> + <li>Fixed a problem where special characters in files or paths, other than spaces and + quotes, were not correctly handled.</li> + </ul> + </li> + <li>Fixed the standalone toolchain to generate proper binaries when using + {@code -lstdc++} (i.e., linking against the GNU {@code libstdc++} C++ runtime). You + should use {@code -lgnustl_shared} if you want to link against the shared library + version or {@code -lstdc++} for the static version. + + <p>See {@code docs/STANDALONE-TOOLCHAIN.html} for more details about this fix.</p> + </li> + <li>Fixed {@code gnustl_shared} on Cygwin. The linker complained that it couldn't find + {@code libsupc++.a} even though the file was at the right location.</li> + <li>Fixed Cygwin C++ link when not using any specific C++ runtime through + {@code APP_STL}.</li> + </ul> + </dd> + </dl> + + <dl> + <dt>Other changes:</dt> + + <dd> + <ul> + <li>When your application uses the GNU {@code libstdc++} runtime, the compiler will + no longer forcibly enable exceptions and RTTI. This change results in smaller code. + <p>If you need these features, you must do one of the following:</p> + <ul> + <li>Enable exceptions and/or RTTI explicitly in your modules or + {@code Application.mk}. (recommended)</li> + <li>Define {@code APP_GNUSTL_FORCE_CPP_FEATURES} to {@code 'exceptions'}, + {@code 'rtti'} or both in your {@code Application.mk}. See + {@code docs/APPLICATION-MK.html} for more details.</li> + </ul> + </li> + <li>{@code ndk-gdb} now works properly when your application has private services + running in independent processes. It debugs the main application process, instead of the + first process listed by {@code ps}, which is usually a service process.</li> + <li>Fixed a rare bug where NDK r7 would fail to honor the {@code LOCAL_ARM_MODE} value + and always compile certain source files (but not all) to 32-bit instructions.</li> + <li>{@code stlport}: Refresh the sources to match the Android platform version. This + update fixes a few minor bugs: + <ul> + <li>Fixed instantiation of an incomplete type</li> + <li>Fixed minor "==" versus "=" typo</li> + <li>Used {@code memmove} instead of {@code memcpy} in {@code string::assign}</li> + <li>Added better handling of {@code IsNANorINF}, {@code IsINF}, {@code IsNegNAN}, + etc.</li> + </ul> + <p>For complete details, see the commit log.</p> + </li> + <li>{@code stlport}: Removed 5 unnecessary static initializers from the library.</li> + <li>The GNU libstdc++ libraries for armeabi-v7a were mistakenly compiled for + armeabi instead. This change had no impact on correctness, but using the right + ABI should provide slightly better performance.</li> + <li>The {@code cpu-features} helper library was updated to report three optional + x86 CPU features ({@code SSSE3}, {@code MOVBE} and {@code POPCNT}). See + {@code docs/CPU-FEATURES.html} for more details.</li> + <li>{@code docs/NDK-BUILD.html} was updated to mention {@code NDK_APPLICATION_MK} instead + of {@code NDK_APP_APPLICATION_MK} to select a custom {@code Application.mk} file.</li> + <li>Cygwin: {@code ndk-build} no longer creates an empty "NUL" file in the current + directory when invoked.</li> + <li>Cygwin: Added better automatic dependency detection. In the previous version, it + didn't work properly in the following cases: + <ul> + <li>When the Cygwin drive prefix was not {@code /cygdrive}.</li> + <li>When using drive-less mounts, for example, when Cygwin would translate + {@code /home} to {@code \\server\subdir} instead of {@code C:\Some\Dir}.</li> + </ul> + </li> + <li>Cygwin: {@code ndk-build} does not try to use the native Windows tools under + {@code $NDK/prebuilt/windows/bin} with certain versions of Cygwin and/or GNU Make.</li> + </ul> + </dd> + </dl> + </div> +</div> + + +<div class="toggleable closed"> + <a href="#" onclick="return toggleDiv(this)"><img src= + "{@docRoot}assets/images/triangle-closed.png" class="toggle-img" height="9px" width="9px"> Android NDK, Revision 7</a> <em>(November 2011)</em> <div class="toggleme"> diff --git a/docs/html/sdk/ndk/overview.jd b/docs/html/sdk/ndk/overview.jd index 85599f7..e969f5d 100644 --- a/docs/html/sdk/ndk/overview.jd +++ b/docs/html/sdk/ndk/overview.jd @@ -46,7 +46,7 @@ page.title=What is the NDK? <li>Documentation, samples, and tutorials</li> </ul> - <p>The latest release of the NDK supports these ARM instruction sets:</p> + <p>The latest release of the NDK supports the following instruction sets:</p> <ul> <li>ARMv5TE (including Thumb-1 instructions)</li> diff --git a/docs/html/sdk/oem-usb.jd b/docs/html/sdk/oem-usb.jd index b81be71..f98257d 100644 --- a/docs/html/sdk/oem-usb.jd +++ b/docs/html/sdk/oem-usb.jd @@ -3,9 +3,21 @@ page.title=OEM USB Drivers <div id="qv-wrapper"> <div id="qv"> + <h2>In this document</h2> + <ol> + <li><a href="#InstallingDriver">Installing a USB Driver</a> + <ol> + <li><a href="#Win7">Windows 7</a></li> + <li><a href="#WinXp">Windows XP</a></li> + <li><a href="#WinVista">Windows Vista</a></li> + </ol> + </li> + <li><a href="#Drivers">OEM Drivers</a></li> + </ol> + <h2>See also</h2> <ol> - <li><a href="{@docRoot}guide/developing/device.html">Developing on a Device</a></li> + <li><a href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a></li> <li><a href="{@docRoot}sdk/win-usb.html">Google USB Driver</a></li> </ol> </div> @@ -18,8 +30,185 @@ where you can download the appropriate USB driver for your device. However, this not exhaustive for all available Android-powered devices.</p> <p>If you're developing on Mac OS X or Linux, then you probably don't need to install a USB driver. -Refer to <a href="{@docRoot}guide/developing/device.html#setting-up">Setting up a Device</a> to -start development with a device.</p> +To start developing with your device, read <a +href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a>.</p> + +<p class="note"><strong>Note:</strong> If your device is one of the Android Developer Phones +(purchased from the Android Market publisher site), a Nexus One, or a Nexus S, then you need +the <a href="{@docRoot}sdk/win-usb.html">Google USB Driver</a>, instead of an OEM driver. The Galaxy +Nexus driver, however, is distributed by <a +href="http://www.samsung.com/us/support/downloads/verizon-wireless/SCH-I515MSAVZW">Samsung</a> +(listed as model SCH-I515).</p> + + +<h2 id="InstallingDriver">Installing a USB Driver</h2> + +<p>First, find the appropriate driver for your device from the <a href="#Drivers">OEM drivers</a> +table below.</p> + +<p>Once you've downloaded your USB driver, follow the instructions below to install or upgrade the +driver, based on your version of Windows and whether you're installing for the first time +or upgrading an existing driver.</p> + +<p class="note"><strong>Tip:</strong> When you finish the USB driver installation, +see <a +href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a> for +other important information about using an Android-powered device for +development.</p> + +<ol class="nolist"> + <li><a href="#Win7">Windows 7</a></li> + <li><a href="#WinXp">Windows XP</a></li> + <li><a href="#WinVista">Windows Vista</a></li> +</ol> + + +<p class="caution"><strong>Caution:</strong> +You may make changes to <code>android_winusb.inf</code> file found inside +<code>usb_driver\</code> (for example, to add support for other devices), +however, this will lead to security warnings when you install or upgrade the +driver. Making any other changes to the driver files may break the installation +process.</p> + + +<h3 id="Win7">Windows 7</h3> + + +<p>To install the Android USB driver on Windows 7 for the first time:</p> +<ol> + <li>Connect your Android-powered device to your computer's USB port.</li> + <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, + and select <strong>Manage</strong>.</li> + <li>Select <strong>Devices</strong> in the left pane.</li> + <li>Locate and expand <em>Other device</em> in the right pane.</li> + <li>Right-click the device name (such as <em>Nexus S</em>) and select <strong>Update + Driver Software</strong>. + This will launch the Hardware Update Wizard.</li> + <li>Select <strong>Browse my computer for driver software</strong> and click + <strong>Next</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> + <li>Click <strong>Next</strong> to install the driver.</li> +</ol> + +<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows 7 with the new +driver:</p> + +<ol> + <li>Connect your Android-powered device to your computer's USB port.</li> + <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, + and select <strong>Manage</strong>.</li> + <li>Select <strong>Device Manager</strong> in the left pane of the Computer Management + window.</li> + <li>Locate and expand <em>Android Phone</em> in the right pane.</li> + <li>Right-click <em>Android Composite ADB Interface</em> and select <strong>Update + Driver</strong>. + This will launch the Hardware Update Wizard.</li> + <li>Select <strong>Install from a list or specific location</strong> and click + <strong>Next</strong>.</li> + <li>Select <strong>Search for the best driver in these locations</strong>; un-check +<strong>Search removable media</strong>; and check <strong>Include this location in the +search</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> + <li>Click <strong>Next</strong> to upgrade the driver.</li> +</ol> + + + + + +<h3 id="WinXp">Windows XP</h3> + +<p>To install the Android USB driver on Windows XP for the first time:</p> + +<ol> + <li>Connect your Android-powered device to your computer's USB port. Windows + will detect the device and launch the Hardware Update Wizard.</li> + <li>Select <strong>Install from a list or specific location</strong> and click + <strong>Next</strong>.</li> + <li>Select <strong>Search for the best driver in these locations</strong>; un-check +<strong>Search + removable media</strong>; and check <strong>Include +this location in the search</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> + <li>Click <strong>Next</strong> to install the driver.</li> +</ol> + +<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows XP with the new +driver:</p> + +<ol> + <li>Connect your Android-powered device to your computer's USB port.</li> + <li>Right-click on <em>My Computer</em> from your desktop or Windows Explorer, + and select <strong>Manage</strong>.</li> + <li>Select <strong>Device Manager</strong> in the left pane.</li> + <li>Locate and expand <em>Android Phone</em> in the right pane.</li> + <li>Right-click <em>Android Composite ADB Interface</em> and select <strong>Update + Driver</strong>. + This will launch the Hardware Update Wizard.</li> + <li>Select <strong>Install from a list or specific location</strong> and click + <strong>Next</strong>.</li> + <li>Select <strong>Search for the best driver in these locations</strong>; un-check <strong>Search + removable media</strong>; and check <strong>Include +this location in the search</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> + <li>Click <strong>Next</strong> to upgrade the driver.</li> +</ol> + + + +<h3 id="WinVista">Windows Vista</h3> + +<p>To install the Android USB driver on Windows Vista for the first time:</p> + +<ol> + <li>Connect your Android-powered device to your computer's USB port. Windows + will detect the device and launch the Found New Hardware wizard.</li> + <li>Select <strong>Locate and install driver software</strong>.</li> + <li>Select <strong>Don't search online</strong>.</li> + <li>Select <strong>I don't have the disk. Show me other options</strong>.</li> + <li>Select <strong>Browse my computer for driver software</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the +exact location of the + installation package, you may leave <strong>Include subfolders</strong> checked or + unchecked—it doesn't matter.</li> + <li>Click <strong>Next</strong>. Vista may prompt you to confirm the privilege elevation + required for driver installation. Confirm it.</li> + <li>When Vista asks if you'd like to install the Google ADB Interface device, + click <strong>Install</strong> to install the driver.</li> +</ol> + +<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows Vista with the new +driver:</p> + +<ol> + <li>Connect your Android-powered device to your computer's USB port.</li> + <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, + and select <strong>Manage</strong>.</li> + <li>Select <strong>Device Manager</strong> in the left pane.</li> + <li>Locate and expand <em>ADB Interface</em> in the right pane.</li> + <li>Right-click on <em>HTC Dream Composite ADB Interface</em>, and select <strong>Update + Driver Software</strong>.</li> + <li>When Vista starts updating the driver, a prompt will ask how you want to + search for the driver + software. Select <strong>Browse my computer for driver software</strong>.</li> + <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB +Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the +exact location of the + installation package, you may leave <strong>Include subfolders</strong> checked or + unchecked—it doesn't matter.</li> + <li>Click <strong>Next</strong>. Vista might prompt you to confirm the privilege elevation + required for driver installation. Confirm it.</li> + <li>When Vista asks if you'd like to install the Google ADB Interface device, + click <strong>Install</strong> to upgrade the driver.</li> +</ol> + + +<h2 id="Drivers">OEM Drivers</h2> <p class="note"><strong>Note:</strong> If your device is one of the Android Developer Phones (purchased from the Android Market publisher site), a Nexus One, or a Nexus S, then you need @@ -28,10 +217,7 @@ Nexus driver, however, is distributed by <a href="http://www.samsung.com/us/support/downloads/verizon-wireless/SCH-I515MSAVZW">Samsung</a> (listed as model SCH-I515).</p> -<p>For instructions about how to install the driver on Windows, follow the guide for <a - href="{@docRoot}sdk/win-usb.html#InstallingDriver">Installing the USB Driver</a>.</p> -<p class="table-caption"><strong>Table 1.</strong> Links to OEM USB drivers</p> <table><tr> <th>OEM</th> <th>Driver URL</th></tr> @@ -92,7 +278,7 @@ href="http://www.huaweidevice.com/worldwide/downloadCenter.do?method=index">http </tr> <tr><td>KT Tech</td> <td><a -href="http://www.kttech.co.kr/cscenter/download05.asp">http://www.kttech.co.kr/cscenter/download05.asp</a> for EV-S100(Take)</td> +href="http://www.kttech.co.kr/cscenter/download05.asp">http://www.kttech.co.kr/cscenter/download05.asp</a> for EV-S100 (Take)</td> </tr> <tr> <td> diff --git a/docs/html/sdk/sdk_toc.cs b/docs/html/sdk/sdk_toc.cs index 0de477a..f7541f7 100644 --- a/docs/html/sdk/sdk_toc.cs +++ b/docs/html/sdk/sdk_toc.cs @@ -195,7 +195,7 @@ class="new">new!</span> <span style="display:none" class="zh-TW"></span> </span> <ul> - <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r7</a> + <li><a href="<?cs var:toroot ?>sdk/ndk/index.html">Android NDK, r7b</a> <span class="new">new!</span> </li> <li><a href="<?cs var:toroot ?>sdk/ndk/overview.html">What is the NDK?</a></li> diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd index 2d1435b..2bd031e 100644 --- a/docs/html/sdk/win-usb.jd +++ b/docs/html/sdk/win-usb.jd @@ -7,19 +7,12 @@ page.title=Google USB Driver <ol> <li><a href="#notes">Revisions</a></li> <li><a href="#WinUsbDriver">Downloading the Google USB Driver</a></li> - <li><a href="#InstallingDriver">Installing the USB Driver</a> - <ol> - <li><a href="#Win7">Windows 7</a></li> - <li><a href="#WinXp">Windows XP</a></li> - <li><a href="#WinVista">Windows Vista</a></li> - </ol> - </li> </ol> <h2>See also</h2> <ol> - <li><a href="{@docRoot}guide/developing/device.html">Developing on a Device</a></li> + <li><a href="{@docRoot}sdk/oem-usb.html#InstallingDriver">Installing a USB Driver</a></li> + <li><a href="{@docRoot}guide/developing/device.html">Using Hardware Devices</a></li> <li><a href="{@docRoot}sdk/adding-components.html">Adding SDK Components</a></li> - <li><a href="{@docRoot}sdk/oem-usb.html">OEM USB Drivers</a></li> </ol> </div> </div> @@ -43,9 +36,9 @@ href="http://www.samsung.com/us/support/downloads/verizon-wireless/SCH-I515MSAVZ (listed as model SCH-I515).</p> <p class="note"><strong>Note:</strong> -If you're developing on Mac OS X or Linux, then you do not need to install a USB driver. Refer to <a -href="{@docRoot}guide/developing/device.html#setting-up">Setting up a Device</a> to start -development with a device.</p> +If you're developing on Mac OS X or Linux, then you do not need to install a USB driver. To start +developing with your device, also read <a href="{@docRoot}guide/developing/device.html">Using +Hardware Devices</a>.</p> <p>The sections below provide instructions on how to download and install the Google USB Driver for Windows. </p> @@ -170,174 +163,10 @@ included with the <a href="{@docRoot}sdk/index.html">Android SDK</a>:</p> <ol> <li>Launch the SDK and AVD Manager by double-clicking <code>SDK Manager.exe</code>, at the root of your SDK directory.</li> - <li>Expand the <em>Third party Add-ons</em> and <em>Google Inc. add-ons</em>.</li> - <li>Check <strong>Google Usb Driver package</strong> and click <strong>Install selected</strong>.</li> + <li>Expand <em>Extras</em>.</li> + <li>Check <strong>Google USB Driver package</strong> and click <strong>Install</strong>.</li> <li>Proceed to install the package. When done, the driver files are downloaded into the <code><sdk>\extras\google\usb_driver\</code> directory.</li> </ol> - - -<h2 id="InstallingDriver">Installing the USB Driver</h2> - -<p>Once you've downloaded your USB driver, follow the instructions below to install or upgrade the -driver, based on your version of Windows and whether you're installing for the first time -or upgrading an existing driver.</p> - -<p class="note"><strong>Tip:</strong> When you finish the USB driver installation, -see <a -href="{@docRoot}guide/developing/device.html">Developing on a Device</a> for -other important information about using an Android-powered device for -development.</p> - -<ol class="nolist"> - <li><a href="#Win7">Windows 7</a></li> - <li><a href="#WinXp">Windows XP</a></li> - <li><a href="#WinVista">Windows Vista</a></li> -</ol> - - -<p class="caution"><strong>Caution:</strong> -You may make changes to <code>android_winusb.inf</code> file found inside -<code>usb_driver\</code> (for example, to add support for other devices), -however, this will lead to security warnings when you install or upgrade the -driver. Making any other changes to the driver files may break the installation -process.</p> - - -<h3 id="Win7">Windows 7</h3> - - -<p>To install the Android USB driver on Windows 7 for the first time:</p> -<ol> - <li>Connect your Android-powered device to your computer's USB port.</li> - <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, - and select <strong>Manage</strong>.</li> - <li>Select <strong>Devices</strong> in the left pane.</li> - <li>Locate and expand <em>Other device</em> in the right pane.</li> - <li>Right-click the device name (such as <em>Nexus S</em>) and select <strong>Update - Driver Software</strong>. - This will launch the Hardware Update Wizard.</li> - <li>Select <strong>Browse my computer for driver software</strong> and click - <strong>Next</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> - <li>Click <strong>Next</strong> to install the driver.</li> -</ol> - -<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows 7 with the new -driver:</p> - -<ol> - <li>Connect your Android-powered device to your computer's USB port.</li> - <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, - and select <strong>Manage</strong>.</li> - <li>Select <strong>Device Manager</strong> in the left pane of the Computer Management - window.</li> - <li>Locate and expand <em>Android Phone</em> in the right pane.</li> - <li>Right-click <em>Android Composite ADB Interface</em> and select <strong>Update - Driver</strong>. - This will launch the Hardware Update Wizard.</li> - <li>Select <strong>Install from a list or specific location</strong> and click - <strong>Next</strong>.</li> - <li>Select <strong>Search for the best driver in these locations</strong>; un-check -<strong>Search removable media</strong>; and check <strong>Include this location in the -search</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> - <li>Click <strong>Next</strong> to upgrade the driver.</li> -</ol> - - - - - -<h3 id="WinXp">Windows XP</h3> - -<p>To install the Android USB driver on Windows XP for the first time:</p> - -<ol> - <li>Connect your Android-powered device to your computer's USB port. Windows - will detect the device and launch the Hardware Update Wizard.</li> - <li>Select <strong>Install from a list or specific location</strong> and click - <strong>Next</strong>.</li> - <li>Select <strong>Search for the best driver in these locations</strong>; un-check -<strong>Search - removable media</strong>; and check <strong>Include -this location in the search</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> - <li>Click <strong>Next</strong> to install the driver.</li> -</ol> - -<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows XP with the new -driver:</p> - -<ol> - <li>Connect your Android-powered device to your computer's USB port.</li> - <li>Right-click on <em>My Computer</em> from your desktop or Windows Explorer, - and select <strong>Manage</strong>.</li> - <li>Select <strong>Device Manager</strong> in the left pane.</li> - <li>Locate and expand <em>Android Phone</em> in the right pane.</li> - <li>Right-click <em>Android Composite ADB Interface</em> and select <strong>Update - Driver</strong>. - This will launch the Hardware Update Wizard.</li> - <li>Select <strong>Install from a list or specific location</strong> and click - <strong>Next</strong>.</li> - <li>Select <strong>Search for the best driver in these locations</strong>; un-check <strong>Search - removable media</strong>; and check <strong>Include -this location in the search</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.)</li> - <li>Click <strong>Next</strong> to upgrade the driver.</li> -</ol> - - - -<h3 id="WinVista">Windows Vista</h3> - -<p>To install the Android USB driver on Windows Vista for the first time:</p> - -<ol> - <li>Connect your Android-powered device to your computer's USB port. Windows - will detect the device and launch the Found New Hardware wizard.</li> - <li>Select <strong>Locate and install driver software</strong>.</li> - <li>Select <strong>Don't search online</strong>.</li> - <li>Select <strong>I don't have the disk. Show me other options</strong>.</li> - <li>Select <strong>Browse my computer for driver software</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the -exact location of the - installation package, you may leave <strong>Include subfolders</strong> checked or - unchecked—it doesn't matter.</li> - <li>Click <strong>Next</strong>. Vista may prompt you to confirm the privilege elevation - required for driver installation. Confirm it.</li> - <li>When Vista asks if you'd like to install the Google ADB Interface device, - click <strong>Install</strong> to install the driver.</li> -</ol> - -<p>Or, to <em>upgrade</em> an existing Android USB driver on Windows Vista with the new -driver:</p> - -<ol> - <li>Connect your Android-powered device to your computer's USB port.</li> - <li>Right-click on <em>Computer</em> from your desktop or Windows Explorer, - and select <strong>Manage</strong>.</li> - <li>Select <strong>Device Manager</strong> in the left pane.</li> - <li>Locate and expand <em>ADB Interface</em> in the right pane.</li> - <li>Right-click on <em>HTC Dream Composite ADB Interface</em>, and select <strong>Update - Driver Software</strong>.</li> - <li>When Vista starts updating the driver, a prompt will ask how you want to - search for the driver - software. Select <strong>Browse my computer for driver software</strong>.</li> - <li>Click <strong>Browse</strong> and locate the USB driver folder. (The Google USB -Driver is located in {@code <sdk>\extras\google\usb_driver\}.) As long as you specified the -exact location of the - installation package, you may leave <strong>Include subfolders</strong> checked or - unchecked—it doesn't matter.</li> - <li>Click <strong>Next</strong>. Vista might prompt you to confirm the privilege elevation - required for driver installation. Confirm it.</li> - <li>When Vista asks if you'd like to install the Google ADB Interface device, - click <strong>Install</strong> to upgrade the driver.</li> -</ol> - +<p>For installation information, read <a href="{@docRoot}sdk/oem-usb.html#InstallingDriver">Installing a USB Driver</a>.</p> diff --git a/docs/html/training/improving-layouts/optimizing-layout.jd b/docs/html/training/improving-layouts/optimizing-layout.jd index 65c8af7..0eaf199 100644 --- a/docs/html/training/improving-layouts/optimizing-layout.jd +++ b/docs/html/training/improving-layouts/optimizing-layout.jd @@ -18,7 +18,7 @@ next.link=reusing-layouts.html <ol> <li><a href="#Inspect">Inspect Your Layout</a></li> <li><a href="#Revise">Revise Your Layout</a></li> - <li><a href="#Layoutopt">Use Layoutopt</a></li> + <li><a href="#Lint">Use Lint</a></li> </ol> <!-- other docs (NOT javadocs) --> @@ -44,7 +44,7 @@ is inflated repeatedly, such as when used in a {@link android.widget.ListView} o android.widget.GridView}.</p> <p>In this lesson you'll learn to use <a -href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Heirachy Viewer</a> and <a +href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a> and <a href="{@docRoot}guide/developing/tools/layoutopt.html">Layoutopt</a> to examine and optimize your layout.</p> @@ -53,7 +53,7 @@ layout.</p> <h2 id="Inspect">Inspect Your Layout</h2> <p>The Android SDK tools include a tool called <a -href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Heirachy Viewer</a> that allows +href="{@docRoot}guide/developing/tools/hierarchy-viewer.html">Hierarchy Viewer</a> that allows you to analyze your layout while your application is running. Using this tool helps you discover bottlenecks in the layout performance.</p> @@ -130,27 +130,28 @@ example of how each layout has appropriate uses and you should carefully conside layout weight is necessary.</p> -<h2 id="Layoutopt">Use Layoutopt</h2> +<h2 id="Lint">Use Lint</h2> + +<p>It is always good practice to run the <a href="http://tools.android.com/tips/lint">Lint</a> tool on your layout files to search for possible view hierarchy optimizations. Lint has replaced the Layoutopt tool and has much greater functionality. Some examples of Lint <a +href="http://tools.android.com/tips/lint-checks">rules</a> are:</p> + +<ul> +<li>Use compound drawables - A {@link android.widget.LinearLayout} which contains an {@link android.widget.ImageView} and a {@link android.widget.TextView} can be more efficiently handled as a compound drawable.</li> +<li>Merge root frame - If a {@link android.widget.FrameLayout} is the root of a layout and does not provide background or padding etc, it can be replaced with a merge tag which is slightly more efficient.</li> +<li>Useless leaf - A layout that has no children or no background can often be removed (since it is invisible) for a flatter and more efficient layout hierarchy.</li> +<li>Useless parent - A layout with children that has no siblings, is not a {@link android.widget.ScrollView} or a root layout, and does not have a background, can be removed and have its children moved directly into the parent for a flatter and more efficient layout hierarchy.</li> +<li>Deep layouts - Layouts with too much nesting are bad for performance. Consider using flatter layouts such as {@link android.widget.RelativeLayout} or {@link android.widget.GridLayout} to improve performance. The default maximum depth is 10.</li> +</ul> + +<p>Another benefit of Lint is that it is integrated into the Android Development Tools for Eclipse (ADT 16+). Lint automatically runs whenever you export an APK, edit and save an XML file or use the Layout Editor. To manually force Lint to run press the Lint button in the Eclipse toolbar.</p> + +<img src="{@docRoot}images/training/lint_icon.png" alt="" /> + +<p>When used inside Eclipse, Lint has the ability to automatically fix some issues, provide suggestions for others and jump directly to the offending code for review. If you don’t use Eclipse for your development, Lint can also be run from the command line. More information about Lint is available at <a href="http://tools.android.com/tips/lint">tools.android.com</a>.</p> + + -<p>It is always good practice to also run the <a -href="{@docRoot}guide/developing/tools/layoutopt.html">layoutopt</a> tool on your final layout files -to search for places in your view hierarchy that may be optimized. Layoutopt is also in your SDK -{@code tools/} directory and takes a layout directory name or a space-separated list of layout files -that you'd like to inspect.</p> -<p>When you run {@code layoutopt} on a layout file, it prints a line number for each issue found, a -description of the issue, and for some types of issues it also suggests a resolution. For -example:</p> -<pre class="no-pretty-print classic"> -$ layoutopt samples/ -samples/compound.xml - 7:23 The root-level <FrameLayout/> can be replaced with <merge/> - 11:21 This LinearLayout layout or its FrameLayout parent is useless -samples/simple.xml - 7:7 The root-level <FrameLayout/> can be replaced with <merge/> -</pre> -<p>After you apply the suggested layout optimizations, run Hierarchy Viewer again to inspect the -performance changes.</p> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java index d46ab6c..506dd9a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -88,6 +88,7 @@ public class NetworkController extends BroadcastReceiver { int mLastSignalLevel; boolean mShowPhoneRSSIForData = false; boolean mShowAtLeastThreeGees = false; + boolean mAlwaysShowCdmaRssi = false; String mContentDescriptionPhoneSignal; String mContentDescriptionWifi; @@ -156,7 +157,7 @@ public class NetworkController extends BroadcastReceiver { IBatteryStats mBatteryStats; public interface SignalCluster { - void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon, + void setWifiIndicators(boolean visible, int strengthIcon, int activityIcon, String contentDescription); void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon, int typeIcon, String contentDescription, String typeContentDescription); @@ -176,6 +177,8 @@ public class NetworkController extends BroadcastReceiver { mShowPhoneRSSIForData = res.getBoolean(R.bool.config_showPhoneRSSIForData); mShowAtLeastThreeGees = res.getBoolean(R.bool.config_showMin3G); + mAlwaysShowCdmaRssi = res.getBoolean( + com.android.internal.R.bool.config_alwaysUseCdmaRssi); // set up the default wifi icon, used when no radios have ever appeared updateWifiIcons(); @@ -287,7 +290,7 @@ public class NetworkController extends BroadcastReceiver { // wimax is special cluster.setMobileDataIndicators( true, - mWimaxIconId, + mAlwaysShowCdmaRssi ? mPhoneSignalIconId : mWimaxIconId, mMobileActivityIconId, mDataTypeIconId, mContentDescriptionWimax, @@ -351,7 +354,7 @@ public class NetworkController extends BroadcastReceiver { @Override public void onSignalStrengthsChanged(SignalStrength signalStrength) { if (DEBUG) { - Slog.d(TAG, "onSignalStrengthsChanged signalStrength=" + signalStrength + + Slog.d(TAG, "onSignalStrengthsChanged signalStrength=" + signalStrength + ((signalStrength == null) ? "" : (" level=" + signalStrength.getLevel()))); } mSignalStrength = signalStrength; @@ -469,7 +472,15 @@ public class NetworkController extends BroadcastReceiver { } else { int iconLevel; int[] iconList; - mLastSignalLevel = iconLevel = mSignalStrength.getLevel(); + if (isCdma() && mAlwaysShowCdmaRssi) { + mLastSignalLevel = iconLevel = mSignalStrength.getCdmaLevel(); + if(DEBUG) Slog.d(TAG, "mAlwaysShowCdmaRssi=" + mAlwaysShowCdmaRssi + + " set to cdmaLevel=" + mSignalStrength.getCdmaLevel() + + " instead of level=" + mSignalStrength.getLevel()); + } else { + mLastSignalLevel = iconLevel = mSignalStrength.getLevel(); + } + if (isCdma()) { if (isCdmaEri()) { iconList = TelephonyIcons.TELEPHONY_SIGNAL_STRENGTH_ROAMING[mInetCondition]; @@ -487,7 +498,6 @@ public class NetworkController extends BroadcastReceiver { mPhoneSignalIconId = iconList[iconLevel]; mContentDescriptionPhoneSignal = mContext.getString( AccessibilityContentDescriptions.PHONE_SIGNAL_STRENGTH[iconLevel]); - mDataSignalIconId = TelephonyIcons.DATA_SIGNAL_STRENGTH[mInetCondition][iconLevel]; } } @@ -908,7 +918,7 @@ public class NetworkController extends BroadcastReceiver { mobileLabel = ""; } } else { - mobileLabel + mobileLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected); } @@ -1181,7 +1191,7 @@ public class NetworkController extends BroadcastReceiver { v.setText(wifiLabel); } } - + // mobile label N = mMobileLabelViews.size(); for (int i=0; i<N; i++) { diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 59b6626..0de76a7 100755 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -2217,13 +2217,21 @@ public class PhoneWindowManager implements WindowManagerPolicy { "Laying out navigation bar window: (%d,%d - %d,%d)", pf.left, pf.top, pf.right, pf.bottom)); } - } else if (attrs.type == TYPE_SECURE_SYSTEM_OVERLAY + } else if ((attrs.type == TYPE_SECURE_SYSTEM_OVERLAY + || attrs.type == TYPE_BOOT_PROGRESS) && ((fl & FLAG_FULLSCREEN) != 0)) { // Fullscreen secure system overlays get what they ask for. pf.left = df.left = mUnrestrictedScreenLeft; pf.top = df.top = mUnrestrictedScreenTop; pf.right = df.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth; pf.bottom = df.bottom = mUnrestrictedScreenTop+mUnrestrictedScreenHeight; + } else if (attrs.type == TYPE_BOOT_PROGRESS) { + // Boot progress screen always covers entire display. + pf.left = df.left = cf.left = mUnrestrictedScreenLeft; + pf.top = df.top = cf.top = mUnrestrictedScreenTop; + pf.right = df.right = cf.right = mUnrestrictedScreenLeft+mUnrestrictedScreenWidth; + pf.bottom = df.bottom = cf.bottom + = mUnrestrictedScreenTop+mUnrestrictedScreenHeight; } else { pf.left = df.left = cf.left = mRestrictedScreenLeft; pf.top = df.top = cf.top = mRestrictedScreenTop; diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java index 97fb0b0..b7dc4a2 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -1031,9 +1031,14 @@ private NetworkStateTracker makeWimaxStateTracker() { if ((ni.isConnectedOrConnecting() == true) && !network.isTeardownRequested()) { if (ni.isConnected() == true) { - // add the pid-specific dns - handleDnsConfigurationChange(usedNetworkType); - if (VDBG) log("special network already active"); + final long token = Binder.clearCallingIdentity(); + try { + // add the pid-specific dns + handleDnsConfigurationChange(usedNetworkType); + if (VDBG) log("special network already active"); + } finally { + Binder.restoreCallingIdentity(token); + } return Phone.APN_ALREADY_ACTIVE; } if (VDBG) log("special network already connecting"); @@ -1221,6 +1226,7 @@ private NetworkStateTracker makeWimaxStateTracker() { } if (!ConnectivityManager.isNetworkTypeValid(networkType)) { + if (DBG) log("requestRouteToHostAddress on invalid network: " + networkType); return false; } NetworkStateTracker tracker = mNetTrackers[networkType]; @@ -1233,11 +1239,16 @@ private NetworkStateTracker makeWimaxStateTracker() { } return false; } + final long token = Binder.clearCallingIdentity(); try { InetAddress addr = InetAddress.getByAddress(hostAddress); LinkProperties lp = tracker.getLinkProperties(); return addRouteToAddress(lp, addr); - } catch (UnknownHostException e) {} + } catch (UnknownHostException e) { + if (DBG) log("requestRouteToHostAddress got " + e.toString()); + } finally { + Binder.restoreCallingIdentity(token); + } return false; } @@ -1277,7 +1288,10 @@ private NetworkStateTracker makeWimaxStateTracker() { private boolean modifyRoute(String ifaceName, LinkProperties lp, RouteInfo r, int cycleCount, boolean doAdd, boolean toDefaultTable) { - if ((ifaceName == null) || (lp == null) || (r == null)) return false; + if ((ifaceName == null) || (lp == null) || (r == null)) { + if (DBG) log("modifyRoute got unexpected null: " + ifaceName + ", " + lp + ", " + r); + return false; + } if (cycleCount > MAX_HOSTROUTE_CYCLE_COUNT) { loge("Error modifying route - too much recursion"); @@ -1309,7 +1323,7 @@ private NetworkStateTracker makeWimaxStateTracker() { } } catch (Exception e) { // never crash - catch them all - if (VDBG) loge("Exception trying to add a route: " + e); + if (DBG) loge("Exception trying to add a route: " + e); return false; } } else { @@ -1323,7 +1337,7 @@ private NetworkStateTracker makeWimaxStateTracker() { mNetd.removeRoute(ifaceName, r); } catch (Exception e) { // never crash - catch them all - if (VDBG) loge("Exception trying to remove a route: " + e); + if (DBG) loge("Exception trying to remove a route: " + e); return false; } } else { @@ -1335,7 +1349,7 @@ private NetworkStateTracker makeWimaxStateTracker() { mNetd.removeSecondaryRoute(ifaceName, r); } catch (Exception e) { // never crash - catch them all - if (VDBG) loge("Exception trying to remove a route: " + e); + if (DBG) loge("Exception trying to remove a route: " + e); return false; } } @@ -2004,7 +2018,7 @@ private NetworkStateTracker makeWimaxStateTracker() { mNetd.removeRoute(ifaceName, r); } catch (Exception e) { // never crash - catch them all - if (VDBG) loge("Exception trying to remove a route: " + e); + if (DBG) loge("Exception trying to remove a route: " + e); } } } @@ -2218,7 +2232,7 @@ private NetworkStateTracker makeWimaxStateTracker() { mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses)); mNetd.setDefaultInterfaceForDns(iface); } catch (Exception e) { - if (VDBG) loge("exception setting default dns interface: " + e); + if (DBG) loge("exception setting default dns interface: " + e); } } if (!domains.equals(SystemProperties.get("net.dns.search"))) { @@ -2248,7 +2262,7 @@ private NetworkStateTracker makeWimaxStateTracker() { mNetd.setDnsServersForInterface(p.getInterfaceName(), NetworkUtils.makeStrings(dnses)); } catch (Exception e) { - if (VDBG) loge("exception setting dns servers: " + e); + if (DBG) loge("exception setting dns servers: " + e); } // set per-pid dns for attached secondary nets List pids = mNetRequestersPids[netType]; diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index f5c4ed4..7d4faea 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -780,7 +780,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return flags; } - InputBindResult attachNewInputLocked(boolean initial, boolean needResult) { + InputBindResult attachNewInputLocked(boolean initial) { if (!mBoundToMethod) { executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO( MSG_BIND_INPUT, mCurMethod, mCurClient.binding)); @@ -798,14 +798,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (DEBUG) Slog.v(TAG, "Attach new input asks to show input"); showCurrentInputLocked(getAppShowFlags(), null); } - return needResult - ? new InputBindResult(session.session, mCurId, mCurSeq) - : null; + return new InputBindResult(session.session, mCurId, mCurSeq); } InputBindResult startInputLocked(IInputMethodClient client, - IInputContext inputContext, EditorInfo attribute, - boolean initial, boolean needResult) { + IInputContext inputContext, EditorInfo attribute, int controlFlags) { // If no method is currently selected, do nothing. if (mCurMethodId == null) { return mNoBinding; @@ -831,6 +828,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } catch (RemoteException e) { } + return startInputUncheckedLocked(cs, inputContext, attribute, controlFlags); + } + + InputBindResult startInputUncheckedLocked(ClientState cs, + IInputContext inputContext, EditorInfo attribute, int controlFlags) { + // If no method is currently selected, do nothing. + if (mCurMethodId == null) { + return mNoBinding; + } + if (mCurClient != cs) { // If the client is changing, we need to switch over to the new // one. @@ -861,7 +868,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if (cs.curSession != null) { // Fast case: if we are already connected to the input method, // then just return it. - return attachNewInputLocked(initial, needResult); + return attachNewInputLocked( + (controlFlags&InputMethodManager.CONTROL_START_INITIAL) != 0); } if (mHaveConnection) { if (mCurMethod != null) { @@ -942,13 +950,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub @Override public InputBindResult startInput(IInputMethodClient client, - IInputContext inputContext, EditorInfo attribute, - boolean initial, boolean needResult) { + IInputContext inputContext, EditorInfo attribute, int controlFlags) { synchronized (mMethodMap) { final long ident = Binder.clearCallingIdentity(); try { - return startInputLocked(client, inputContext, attribute, - initial, needResult); + return startInputLocked(client, inputContext, attribute, controlFlags); } finally { Binder.restoreCallingIdentity(ident); } @@ -991,7 +997,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mCurClient.curSession = new SessionState(mCurClient, method, session); mCurClient.sessionRequested = false; - InputBindResult res = attachNewInputLocked(true, true); + InputBindResult res = attachNewInputLocked(true); if (res.method != null) { executeOrSendMessage(mCurClient.client, mCaller.obtainMessageOO( MSG_BIND_METHOD, mCurClient.client, res)); @@ -1476,36 +1482,45 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @Override - public void windowGainedFocus(IInputMethodClient client, IBinder windowToken, - boolean viewHasFocus, boolean isTextEditor, int softInputMode, - boolean first, int windowFlags) { + public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder windowToken, + int controlFlags, int softInputMode, int windowFlags, + EditorInfo attribute, IInputContext inputContext) { + InputBindResult res = null; long ident = Binder.clearCallingIdentity(); try { synchronized (mMethodMap) { if (DEBUG) Slog.v(TAG, "windowGainedFocus: " + client.asBinder() - + " viewHasFocus=" + viewHasFocus - + " isTextEditor=" + isTextEditor + + " controlFlags=#" + Integer.toHexString(controlFlags) + " softInputMode=#" + Integer.toHexString(softInputMode) - + " first=" + first + " flags=#" - + Integer.toHexString(windowFlags)); + + " windowFlags=#" + Integer.toHexString(windowFlags)); - if (mCurClient == null || client == null - || mCurClient.client.asBinder() != client.asBinder()) { - try { - // We need to check if this is the current client with - // focus in the window manager, to allow this call to - // be made before input is started in it. - if (!mIWindowManager.inputMethodClientHasFocus(client)) { - Slog.w(TAG, "Client not active, ignoring focus gain of: " + client); - return; - } - } catch (RemoteException e) { + ClientState cs = mClients.get(client.asBinder()); + if (cs == null) { + throw new IllegalArgumentException("unknown client " + + client.asBinder()); + } + + try { + if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) { + // Check with the window manager to make sure this client actually + // has a window with focus. If not, reject. This is thread safe + // because if the focus changes some time before or after, the + // next client receiving focus that has any interest in input will + // be calling through here after that change happens. + Slog.w(TAG, "Focus gain on non-focused client " + cs.client + + " (uid=" + cs.uid + " pid=" + cs.pid + ")"); + return null; } + } catch (RemoteException e) { } if (mCurFocusedWindow == windowToken) { Slog.w(TAG, "Window already focused, ignoring focus gain of: " + client); - return; + if (attribute != null) { + return startInputUncheckedLocked(cs, inputContext, attribute, + controlFlags); + } + return null; } mCurFocusedWindow = windowToken; @@ -1521,6 +1536,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE || mRes.getConfiguration().isLayoutSizeAtLeast( Configuration.SCREENLAYOUT_SIZE_LARGE); + final boolean isTextEditor = + (controlFlags&InputMethodManager.CONTROL_WINDOW_IS_TEXT_EDITOR) != 0; + + // We want to start input before showing the IME, but after closing + // it. We want to do this after closing it to help the IME disappear + // more quickly (not get stuck behind it initializing itself for the + // new focused input, even if its window wants to hide the IME). + boolean didStart = false; switch (softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE) { case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: @@ -1536,12 +1559,17 @@ public class InputMethodManagerService extends IInputMethodManager.Stub WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) { // There is a focus view, and we are navigating forward // into the window, so show the input window for the user. - // We only do this automatically if the window an resize - // to accomodate the IME (so what the user sees will give + // We only do this automatically if the window can resize + // to accommodate the IME (so what the user sees will give // them good context without input information being obscured // by the IME) or if running on a large screen where there // is more room for the target window + IME. if (DEBUG) Slog.v(TAG, "Unspecified window will show input"); + if (attribute != null) { + res = startInputUncheckedLocked(cs, inputContext, attribute, + controlFlags); + didStart = true; + } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); } break; @@ -1563,18 +1591,35 @@ public class InputMethodManagerService extends IInputMethodManager.Stub if ((softInputMode & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION) != 0) { if (DEBUG) Slog.v(TAG, "Window asks to show input going forward"); + if (attribute != null) { + res = startInputUncheckedLocked(cs, inputContext, attribute, + controlFlags); + didStart = true; + } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); } break; case WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE: if (DEBUG) Slog.v(TAG, "Window asks to always show input"); + if (attribute != null) { + res = startInputUncheckedLocked(cs, inputContext, attribute, + controlFlags); + didStart = true; + } showCurrentInputLocked(InputMethodManager.SHOW_IMPLICIT, null); break; } + + if (!didStart && attribute != null) { + res = startInputUncheckedLocked(cs, inputContext, attribute, + controlFlags); + } } } finally { Binder.restoreCallingIdentity(ident); } + + return res; } @Override diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java index 5039294..3cf447c 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -767,7 +767,9 @@ public class NotificationManagerService extends INotificationManager.Stub long identity = Binder.clearCallingIdentity(); try { r.statusBarKey = mStatusBar.addNotification(n); - mAttentionLight.pulse(); + if ((n.notification.flags & Notification.FLAG_SHOW_LIGHTS) != 0) { + mAttentionLight.pulse(); + } } finally { Binder.restoreCallingIdentity(identity); diff --git a/services/java/com/android/server/wm/DimAnimator.java b/services/java/com/android/server/wm/DimAnimator.java index a3293e8..a9d4e01 100644 --- a/services/java/com/android/server/wm/DimAnimator.java +++ b/services/java/com/android/server/wm/DimAnimator.java @@ -180,7 +180,9 @@ class DimAnimator { public void printTo(String prefix, PrintWriter pw) { pw.print(prefix); - pw.print("mDimSurface="); pw.println(mDimSurface); + pw.print("mDimSurface="); pw.print(mDimSurface); + pw.print(" "); pw.print(mLastDimWidth); pw.print(" x "); + pw.println(mLastDimHeight); pw.print(prefix); pw.print("mDimShown="); pw.print(mDimShown); pw.print(" current="); pw.print(mDimCurrentAlpha); diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java index bd33e0c..3f72dec 100644 --- a/services/java/com/android/server/wm/WindowManagerService.java +++ b/services/java/com/android/server/wm/WindowManagerService.java @@ -8593,7 +8593,11 @@ public class WindowManagerService extends IWindowManager.Stub if (mDimAnimator == null) { mDimAnimator = new DimAnimator(mFxSession); } - mDimAnimator.show(innerDw, innerDh); + if (attrs.type == WindowManager.LayoutParams.TYPE_BOOT_PROGRESS) { + mDimAnimator.show(dw, dh); + } else { + mDimAnimator.show(innerDw, innerDh); + } mDimAnimator.updateParameters(mContext.getResources(), w, currentTime); } diff --git a/telephony/java/com/android/internal/telephony/DataConnection.java b/telephony/java/com/android/internal/telephony/DataConnection.java index ffe848d..d0e304f 100644 --- a/telephony/java/com/android/internal/telephony/DataConnection.java +++ b/telephony/java/com/android/internal/telephony/DataConnection.java @@ -68,6 +68,8 @@ public abstract class DataConnection extends StateMachine { private List<ApnContext> mApnList = null; PendingIntent mReconnectIntent = null; + private DataConnectionTracker mDataConnectionTracker = null; + /** * Used internally for saving connecting parameters. */ @@ -202,6 +204,7 @@ public abstract class DataConnection extends StateMachine { protected static final int EVENT_DEACTIVATE_DONE = BASE + 3; protected static final int EVENT_DISCONNECT = BASE + 4; protected static final int EVENT_RIL_CONNECTED = BASE + 5; + protected static final int EVENT_DISCONNECT_ALL = BASE + 6; //***** Tag IDs for EventLog protected static final int EVENT_LOG_BAD_DNS_ADDRESS = 50100; @@ -234,10 +237,12 @@ public abstract class DataConnection extends StateMachine { //***** Constructor - protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm) { + protected DataConnection(PhoneBase phone, String name, int id, RetryManager rm, + DataConnectionTracker dct) { super(name); if (DBG) log("DataConnection constructor E"); this.phone = phone; + this.mDataConnectionTracker = dct; mId = id; mRetryMgr = rm; this.cid = -1; @@ -316,11 +321,19 @@ public abstract class DataConnection extends StateMachine { * * @param dp is the DisconnectParams. */ - private void notifyDisconnectCompleted(DisconnectParams dp) { + private void notifyDisconnectCompleted(DisconnectParams dp, boolean sendAll) { if (VDBG) log("NotifyDisconnectCompleted"); + ApnContext alreadySent = null; + String reason = null; + if (dp.onCompletedMsg != null) { + // Get ApnContext, but only valid on GSM devices this is a string on CDMA devices. Message msg = dp.onCompletedMsg; + if (msg.obj instanceof ApnContext) { + alreadySent = (ApnContext)msg.obj; + } + reason = dp.reason; if (VDBG) { log(String.format("msg=%s msg.obj=%s", msg.toString(), ((msg.obj instanceof String) ? (String) msg.obj : "<no-reason>"))); @@ -328,6 +341,17 @@ public abstract class DataConnection extends StateMachine { AsyncResult.forMessage(msg); msg.sendToTarget(); } + if (sendAll) { + for (ApnContext a : mApnList) { + if (a == alreadySent) continue; + if (reason != null) a.setReason(reason); + Message msg = mDataConnectionTracker.obtainMessage( + DataConnectionTracker.EVENT_DISCONNECT_DONE, a); + AsyncResult.forMessage(msg); + msg.sendToTarget(); + } + } + if (DBG) log("NotifyDisconnectCompleted DisconnectParams=" + dp); } @@ -706,6 +730,13 @@ public abstract class DataConnection extends StateMachine { deferMessage(msg); break; + case EVENT_DISCONNECT_ALL: + if (DBG) { + log("DcDefaultState deferring msg.what=EVENT_DISCONNECT_ALL" + mRefCount); + } + deferMessage(msg); + break; + case EVENT_RIL_CONNECTED: ar = (AsyncResult)msg.obj; if (ar.exception == null) { @@ -771,7 +802,7 @@ public abstract class DataConnection extends StateMachine { } if (mDisconnectParams != null) { if (VDBG) log("DcInactiveState: enter notifyDisconnectCompleted"); - notifyDisconnectCompleted(mDisconnectParams); + notifyDisconnectCompleted(mDisconnectParams, true); } clearSettings(); } @@ -812,7 +843,13 @@ public abstract class DataConnection extends StateMachine { case EVENT_DISCONNECT: if (DBG) log("DcInactiveState: msg.what=EVENT_DISCONNECT"); - notifyDisconnectCompleted((DisconnectParams)msg.obj); + notifyDisconnectCompleted((DisconnectParams)msg.obj, false); + retVal = HANDLED; + break; + + case EVENT_DISCONNECT_ALL: + if (DBG) log("DcInactiveState: msg.what=EVENT_DISCONNECT_ALL"); + notifyDisconnectCompleted((DisconnectParams)msg.obj, false); retVal = HANDLED; break; @@ -989,12 +1026,24 @@ public abstract class DataConnection extends StateMachine { transitionTo(mDisconnectingState); } else { if (msg.obj != null) { - notifyDisconnectCompleted((DisconnectParams) msg.obj); + notifyDisconnectCompleted((DisconnectParams) msg.obj, false); } } retVal = HANDLED; break; + case EVENT_DISCONNECT_ALL: + if (DBG) { + log("DcActiveState msg.what=EVENT_DISCONNECT_ALL RefCount=" + mRefCount); + } + mRefCount = 0; + DisconnectParams dp = (DisconnectParams) msg.obj; + dp.tag = mTag; + tearDownData(dp); + transitionTo(mDisconnectingState); + retVal = HANDLED; + break; + default: if (VDBG) { log("DcActiveState not handled msg.what=0x" + @@ -1124,4 +1173,16 @@ public abstract class DataConnection extends StateMachine { public void tearDown(String reason, Message onCompletedMsg) { sendMessage(obtainMessage(EVENT_DISCONNECT, new DisconnectParams(reason, onCompletedMsg))); } + + /** + * Tear down the connection through the apn on the network. Ignores refcount and + * and always tears down. + * + * @param onCompletedMsg is sent with its msg.obj as an AsyncResult object. + * With AsyncResult.userObj set to the original msg.obj. + */ + public void tearDownAll(String reason, Message onCompletedMsg) { + sendMessage(obtainMessage(EVENT_DISCONNECT_ALL, + new DisconnectParams(reason, onCompletedMsg))); + } } diff --git a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java index 04ba42d..863235b 100644 --- a/telephony/java/com/android/internal/telephony/DataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/DataConnectionTracker.java @@ -1030,7 +1030,8 @@ public abstract class DataConnectionTracker extends Handler { } } if (didDisable) { - if (enabledCount == 0) { + if ((enabledCount == 0) || (apnId == APN_DUN_ID)) { + mRequestedApnType = Phone.APN_TYPE_DEFAULT; onCleanUpConnection(true, apnId, Phone.REASON_DATA_DISABLED); } diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java index d55f346..a93d94f 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnection.java @@ -20,6 +20,7 @@ import android.os.Message; import android.util.Log; import com.android.internal.telephony.DataConnection; +import com.android.internal.telephony.DataConnectionTracker; import com.android.internal.telephony.Phone; import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.RetryManager; @@ -32,8 +33,9 @@ public class CdmaDataConnection extends DataConnection { private static final String LOG_TAG = "CDMA"; // ***** Constructor - private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm) { - super(phone, name, id, rm); + private CdmaDataConnection(CDMAPhone phone, String name, int id, RetryManager rm, + DataConnectionTracker dct) { + super(phone, name, id, rm, dct); } /** @@ -44,12 +46,13 @@ public class CdmaDataConnection extends DataConnection { * @param rm the RetryManager * @return CdmaDataConnection that was created. */ - static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm) { + static CdmaDataConnection makeDataConnection(CDMAPhone phone, int id, RetryManager rm, + DataConnectionTracker dct) { synchronized (mCountLock) { mCount += 1; } CdmaDataConnection cdmaDc = new CdmaDataConnection(phone, "CdmaDC-" + mCount, - id, rm); + id, rm, dct); cdmaDc.start(); if (DBG) cdmaDc.log("Made " + cdmaDc.getName()); return cdmaDc; diff --git a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java index e2a4a7a..26a028b 100644 --- a/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/cdma/CdmaDataConnectionTracker.java @@ -93,6 +93,9 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { Phone.APN_TYPE_MMS, Phone.APN_TYPE_HIPRI }; + private String[] mDunApnTypes = { + Phone.APN_TYPE_DUN }; + private static final int mDefaultApnId = DataConnectionTracker.APN_DEFAULT_ID; /* Constructor */ @@ -118,11 +121,26 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { createAllDataConnectionList(); broadcastMessenger(); + + Context c = mCdmaPhone.getContext(); + String[] t = c.getResources().getStringArray( + com.android.internal.R.array.config_cdma_dun_supported_types); + if (t != null && t.length > 0) { + ArrayList<String> temp = new ArrayList<String>(); + for(int i=0; i< t.length; i++) { + if (!Phone.APN_TYPE_DUN.equalsIgnoreCase(t[i])) { + temp.add(t[i]); + } + } + temp.add(0, Phone.APN_TYPE_DUN); + mDunApnTypes = temp.toArray(t); + } + } @Override public void dispose() { - cleanUpConnection(false, null); + cleanUpConnection(false, null, false); super.dispose(); @@ -277,7 +295,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { * @param tearDown true if the underlying DataConnection should be disconnected. * @param reason for the clean up. */ - private void cleanUpConnection(boolean tearDown, String reason) { + private void cleanUpConnection(boolean tearDown, String reason, boolean doAll) { if (DBG) log("cleanUpConnection: reason: " + reason); // Clear the reconnect alarm, if set. @@ -297,9 +315,15 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { DataConnectionAc dcac = mDataConnectionAsyncChannels.get(conn.getDataConnectionId()); if (tearDown) { - if (DBG) log("cleanUpConnection: teardown, call conn.disconnect"); - conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE, - conn.getDataConnectionId(), 0, reason)); + if (doAll) { + if (DBG) log("cleanUpConnection: teardown, conn.tearDownAll"); + conn.tearDownAll(reason, obtainMessage(EVENT_DISCONNECT_DONE, + conn.getDataConnectionId(), 0, reason)); + } else { + if (DBG) log("cleanUpConnection: teardown, conn.tearDown"); + conn.tearDown(reason, obtainMessage(EVENT_DISCONNECT_DONE, + conn.getDataConnectionId(), 0, reason)); + } notificationDeferred = true; } else { if (DBG) log("cleanUpConnection: !tearDown, call conn.resetSynchronously"); @@ -343,8 +367,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { String[] types; int apnId; if (mRequestedApnType.equals(Phone.APN_TYPE_DUN)) { - types = new String[1]; - types[0] = Phone.APN_TYPE_DUN; + types = mDunApnTypes; apnId = DataConnectionTracker.APN_DUN_ID; } else { types = mDefaultApnTypes; @@ -582,7 +605,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { @Override protected void onEnableNewApn() { // No mRequestedApnType check; only one connection is supported - cleanUpConnection(true, Phone.REASON_APN_SWITCHED); + cleanUpConnection(true, Phone.REASON_APN_SWITCHED, false); } /** @@ -764,13 +787,13 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { @Override protected void onCleanUpConnection(boolean tearDown, int apnId, String reason) { // No apnId check; only one connection is supported - cleanUpConnection(tearDown, reason); + cleanUpConnection(tearDown, reason, (apnId == APN_DUN_ID)); } @Override protected void onCleanUpAllConnections(String cause) { // Only one CDMA connection is supported - cleanUpConnection(true, cause); + cleanUpConnection(true, cause, false); } private void createAllDataConnectionList() { @@ -789,7 +812,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { } int id = mUniqueIdGenerator.getAndIncrement(); - dataConn = CdmaDataConnection.makeDataConnection(mCdmaPhone, id, rm); + dataConn = CdmaDataConnection.makeDataConnection(mCdmaPhone, id, rm, this); mDataConnections.put(id, dataConn); DataConnectionAc dcac = new DataConnectionAc(dataConn, LOG_TAG); int status = dcac.fullyConnectSync(mPhone.getContext(), this, dataConn.getHandler()); @@ -816,7 +839,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { notifyDataConnection(Phone.REASON_CDMA_DATA_DETACHED); } else { if (mState == State.FAILED) { - cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED); + cleanUpConnection(false, Phone.REASON_CDMA_DATA_DETACHED, false); mDataConnections.get(0).resetRetryCount(); CdmaCellLocation loc = (CdmaCellLocation)(mPhone.getCellLocation()); @@ -895,7 +918,7 @@ public final class CdmaDataConnectionTracker extends DataConnectionTracker { log("onDataStateChanged: No active connection" + "state is CONNECTED, disconnecting/cleanup"); writeEventLogCdmaDataDrop(); - cleanUpConnection(true, null); + cleanUpConnection(true, null, false); return; } diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java index 1f24b58..1f5b7ab 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnection.java @@ -22,6 +22,7 @@ import android.util.Patterns; import android.text.TextUtils; import com.android.internal.telephony.DataConnection; +import com.android.internal.telephony.DataConnectionTracker; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneBase; import com.android.internal.telephony.RILConstants; @@ -38,8 +39,9 @@ public class GsmDataConnection extends DataConnection { protected int mProfileId = RILConstants.DATA_PROFILE_DEFAULT; protected String mActiveApnType = Phone.APN_TYPE_DEFAULT; //***** Constructor - private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm) { - super(phone, name, id, rm); + private GsmDataConnection(PhoneBase phone, String name, int id, RetryManager rm, + DataConnectionTracker dct) { + super(phone, name, id, rm, dct); } /** @@ -50,11 +52,12 @@ public class GsmDataConnection extends DataConnection { * @param rm the RetryManager * @return GsmDataConnection that was created. */ - static GsmDataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm) { + static GsmDataConnection makeDataConnection(PhoneBase phone, int id, RetryManager rm, + DataConnectionTracker dct) { synchronized (mCountLock) { mCount += 1; } - GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDC-" + mCount, id, rm); + GsmDataConnection gsmDc = new GsmDataConnection(phone, "GsmDC-" + mCount, id, rm, dct); gsmDc.start(); if (DBG) gsmDc.log("Made " + gsmDc.getName()); return gsmDc; diff --git a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java index 9eaf7a0..95ea107 100644 --- a/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java +++ b/telephony/java/com/android/internal/telephony/gsm/GsmDataConnectionTracker.java @@ -850,9 +850,28 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { // Connection is still there. Try to clean up. if (dcac != null) { if (apnContext.getState() != State.DISCONNECTING) { - if (DBG) log("cleanUpConnection: tearing down"); + boolean disconnectAll = false; + if (Phone.APN_TYPE_DUN.equals(apnContext.getApnType())) { + ApnSetting dunSetting = fetchDunApn(); + if (dunSetting != null && + dunSetting.equals(apnContext.getApnSetting())) { + if (DBG) log("tearing down dedicated DUN connection"); + // we need to tear it down - we brought it up just for dun and + // other people are camped on it and now dun is done. We need + // to stop using it and let the normal apn list get used to find + // connections for the remaining desired connections + disconnectAll = true; + } + } + if (DBG) { + log("cleanUpConnection: tearing down" + (disconnectAll ? " all" :"")); + } Message msg = obtainMessage(EVENT_DISCONNECT_DONE, apnContext); - apnContext.getDataConnection().tearDown(apnContext.getReason(), msg); + if (disconnectAll) { + apnContext.getDataConnection().tearDownAll(apnContext.getReason(), msg); + } else { + apnContext.getDataConnection().tearDown(apnContext.getReason(), msg); + } apnContext.setState(State.DISCONNECTING); } } else { @@ -2213,7 +2232,7 @@ public final class GsmDataConnectionTracker extends DataConnectionTracker { RetryManager rm = new RetryManager(); int id = mUniqueIdGenerator.getAndIncrement(); - GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm); + GsmDataConnection conn = GsmDataConnection.makeDataConnection(mPhone, id, rm, this); mDataConnections.put(id, conn); DataConnectionAc dcac = new DataConnectionAc(conn, LOG_TAG); int status = dcac.fullyConnectSync(mPhone.getContext(), this, conn.getHandler()); diff --git a/tools/aapt/XMLNode.cpp b/tools/aapt/XMLNode.cpp index 95a68d1..8d7acee 100644 --- a/tools/aapt/XMLNode.cpp +++ b/tools/aapt/XMLNode.cpp @@ -21,6 +21,7 @@ const char* const RESOURCES_ROOT_NAMESPACE = "http://schemas.android.com/apk/res/"; const char* const RESOURCES_ANDROID_NAMESPACE = "http://schemas.android.com/apk/res/android"; +const char* const RESOURCES_AUTO_PACKAGE_NAMESPACE = "http://schemas.android.com/apk/res-auto"; const char* const RESOURCES_ROOT_PRV_NAMESPACE = "http://schemas.android.com/apk/prv/res/"; const char* const XLIFF_XMLNS = "urn:oasis:names:tc:xliff:document:1.2"; @@ -44,16 +45,21 @@ bool isWhitespace(const char16_t* str) } static const String16 RESOURCES_PREFIX(RESOURCES_ROOT_NAMESPACE); +static const String16 RESOURCES_PREFIX_AUTO_PACKAGE(RESOURCES_AUTO_PACKAGE_NAMESPACE); static const String16 RESOURCES_PRV_PREFIX(RESOURCES_ROOT_PRV_NAMESPACE); static const String16 RESOURCES_TOOLS_NAMESPACE("http://schemas.android.com/tools"); -String16 getNamespaceResourcePackage(String16 namespaceUri, bool* outIsPublic) +String16 getNamespaceResourcePackage(String16 appPackage, String16 namespaceUri, bool* outIsPublic) { //printf("%s starts with %s?\n", String8(namespaceUri).string(), // String8(RESOURCES_PREFIX).string()); size_t prefixSize; bool isPublic = true; - if (namespaceUri.startsWith(RESOURCES_PREFIX)) { + if(namespaceUri.startsWith(RESOURCES_PREFIX_AUTO_PACKAGE)) { + NOISY(printf("Using default application package: %s -> %s\n", String8(namespaceUri).string(), String8(appPackage).string())); + isPublic = true; + return appPackage; + } else if (namespaceUri.startsWith(RESOURCES_PREFIX)) { prefixSize = RESOURCES_PREFIX.size(); } else if (namespaceUri.startsWith(RESOURCES_PRV_PREFIX)) { isPublic = false; @@ -926,7 +932,7 @@ status_t XMLNode::assignResourceIds(const sp<AaptAssets>& assets, const attribute_entry& e = mAttributes.itemAt(i); if (e.ns.size() <= 0) continue; bool nsIsPublic; - String16 pkg(getNamespaceResourcePackage(e.ns, &nsIsPublic)); + String16 pkg(getNamespaceResourcePackage(String16(assets->getPackage()), e.ns, &nsIsPublic)); NOISY(printf("Elem %s %s=\"%s\": namespace(%s) %s ===> %s\n", String8(getElementName()).string(), String8(e.name).string(), diff --git a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java index 0a3cdc6..6ac5b02 100644 --- a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java +++ b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java @@ -18,6 +18,7 @@ package android.util; import com.android.ide.common.rendering.api.RenderResources; import com.android.ide.common.rendering.api.ResourceValue; +import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; import com.android.layoutlib.bridge.android.BridgeContext; @@ -25,9 +26,6 @@ import com.android.resources.ResourceType; import org.xmlpull.v1.XmlPullParser; -import android.util.AttributeSet; -import android.util.XmlPullAttributes; - /** * A correct implementation of the {@link AttributeSet} interface on top of a XmlPullParser */ @@ -80,21 +78,40 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { return 0; } - /* - * (non-Javadoc) - * @see android.util.XmlPullAttributes#getAttributeResourceValue(int, int) - */ @Override - public int getAttributeResourceValue(int index, int defaultValue) { - String value = getAttributeValue(index); + public int getAttributeListValue(String namespace, String attribute, + String[] options, int defaultValue) { + String value = getAttributeValue(namespace, attribute); + if (value != null) { + ResourceValue r = getResourceValue(value); - return resolveResourceValue(value, defaultValue); + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToList(value, options, defaultValue); + } + + return defaultValue; + } + + @Override + public boolean getAttributeBooleanValue(String namespace, String attribute, + boolean defaultValue) { + String value = getAttributeValue(namespace, attribute); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToBoolean(value, defaultValue); + } + + return defaultValue; } - /* - * (non-Javadoc) - * @see android.util.XmlPullAttributes#getAttributeResourceValue(java.lang.String, java.lang.String, int) - */ @Override public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) { String value = getAttributeValue(namespace, attribute); @@ -102,12 +119,151 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { return resolveResourceValue(value, defaultValue); } - private int resolveResourceValue(String value, int defaultValue) { + @Override + public int getAttributeIntValue(String namespace, String attribute, + int defaultValue) { + String value = getAttributeValue(namespace, attribute); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToInt(value, defaultValue); + } + + return defaultValue; + } + + @Override + public int getAttributeUnsignedIntValue(String namespace, String attribute, + int defaultValue) { + String value = getAttributeValue(namespace, attribute); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToUnsignedInt(value, defaultValue); + } + + return defaultValue; + } + + @Override + public float getAttributeFloatValue(String namespace, String attribute, + float defaultValue) { + String s = getAttributeValue(namespace, attribute); + if (s != null) { + ResourceValue r = getResourceValue(s); + + if (r != null) { + s = r.getValue(); + } + + return Float.parseFloat(s); + } + + return defaultValue; + } + + @Override + public int getAttributeListValue(int index, + String[] options, int defaultValue) { + return XmlUtils.convertValueToList( + getAttributeValue(index), options, defaultValue); + } + + @Override + public boolean getAttributeBooleanValue(int index, boolean defaultValue) { + String value = getAttributeValue(index); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToBoolean(value, defaultValue); + } + + return defaultValue; + } + + @Override + public int getAttributeResourceValue(int index, int defaultValue) { + String value = getAttributeValue(index); + + return resolveResourceValue(value, defaultValue); + } + + @Override + public int getAttributeIntValue(int index, int defaultValue) { + String value = getAttributeValue(index); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToInt(value, defaultValue); + } + + return defaultValue; + } + + @Override + public int getAttributeUnsignedIntValue(int index, int defaultValue) { + String value = getAttributeValue(index); + if (value != null) { + ResourceValue r = getResourceValue(value); + + if (r != null) { + value = r.getValue(); + } + + return XmlUtils.convertValueToUnsignedInt(value, defaultValue); + } + + return defaultValue; + } + + @Override + public float getAttributeFloatValue(int index, float defaultValue) { + String s = getAttributeValue(index); + if (s != null) { + ResourceValue r = getResourceValue(s); + + if (r != null) { + s = r.getValue(); + } + + return Float.parseFloat(s); + } + + return defaultValue; + } + + // -- private helper methods + + /** + * Returns a resolved {@link ResourceValue} from a given value. + */ + private ResourceValue getResourceValue(String value) { // now look for this particular value RenderResources resources = mContext.getRenderResources(); - ResourceValue resource = resources.resolveResValue( - resources.findResValue(value, mPlatformFile)); + return resources.resolveResValue(resources.findResValue(value, mPlatformFile)); + } + /** + * Resolves and return a value to its associated integer. + */ + private int resolveResourceValue(String value, int defaultValue) { + ResourceValue resource = getResourceValue(value); if (resource != null) { Integer id = null; if (mPlatformFile || resource.isFramework()) { @@ -124,5 +280,4 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { return defaultValue; } - } 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 33bf7bc..ff88209 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/Bridge.java @@ -24,8 +24,8 @@ import com.android.ide.common.rendering.api.DrawableParams; import com.android.ide.common.rendering.api.LayoutLog; import com.android.ide.common.rendering.api.RenderSession; import com.android.ide.common.rendering.api.Result; -import com.android.ide.common.rendering.api.SessionParams; import com.android.ide.common.rendering.api.Result.Status; +import com.android.ide.common.rendering.api.SessionParams; import com.android.layoutlib.bridge.impl.FontLoader; import com.android.layoutlib.bridge.impl.RenderDrawable; import com.android.layoutlib.bridge.impl.RenderSessionImpl; @@ -242,6 +242,8 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge { if (fontLoader != null) { Typeface_Delegate.init(fontLoader); } else { + log.error(LayoutLog.TAG_BROKEN, + "Failed create FontLoader in layout lib.", null); return false; } diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeConstants.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeConstants.java index 112af1e..eb9e7f1 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeConstants.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeConstants.java @@ -39,6 +39,9 @@ public class BridgeConstants { /** Namespace for the resource XML */ public final static String NS_RESOURCES = "http://schemas.android.com/apk/res/android"; + /** App auto namespace */ + public final static String NS_APP_RES_AUTO = "http://schemas.android.com/apk/res-auto"; + public final static String R = "com.android.internal.R"; 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 fbbcbc1..9dbe82f 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 @@ -49,8 +49,8 @@ import android.content.res.BridgeResources; import android.content.res.BridgeTypedArray; import android.content.res.Configuration; import android.content.res.Resources; -import android.content.res.TypedArray; import android.content.res.Resources.Theme; +import android.content.res.TypedArray; import android.database.DatabaseErrorHandler; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; @@ -78,8 +78,8 @@ import java.io.InputStream; import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Map; -import java.util.TreeMap; import java.util.Map.Entry; +import java.util.TreeMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; @@ -615,7 +615,8 @@ public final class BridgeContext extends Context { } String namespace = BridgeConstants.NS_RESOURCES; - if (frameworkAttributes.get() == false) { + boolean useFrameworkNS = frameworkAttributes.get(); + if (useFrameworkNS == false) { // need to use the application namespace namespace = mProjectCallback.getNamespace(); } @@ -628,6 +629,12 @@ public final class BridgeContext extends Context { String value = null; if (set != null) { value = set.getAttributeValue(namespace, name); + + // if this is an app attribute, and the first get fails, try with the + // new res-auto namespace as well + if (useFrameworkNS == false && value == null) { + value = set.getAttributeValue(BridgeConstants.NS_APP_RES_AUTO, name); + } } // if there's no direct value for this attribute in the XML, we look for default diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java index 2a52888..a37a356 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeIInputMethodManager.java @@ -160,8 +160,9 @@ public class BridgeIInputMethodManager implements IInputMethodManager { return false; } - public InputBindResult startInput(IInputMethodClient arg0, IInputContext arg1, EditorInfo arg2, - boolean arg3, boolean arg4) throws RemoteException { + + public InputBindResult startInput(IInputMethodClient client, IInputContext inputContext, + EditorInfo attribute, int controlFlags) throws RemoteException { // TODO Auto-generated method stub return null; } @@ -176,10 +177,12 @@ public class BridgeIInputMethodManager implements IInputMethodManager { } - public void windowGainedFocus(IInputMethodClient arg0, IBinder arg1, boolean arg2, - boolean arg3, int arg4, boolean arg5, int arg6) throws RemoteException { + @Override + public InputBindResult windowGainedFocus(IInputMethodClient client, IBinder windowToken, + int controlFlags, int softInputMode, int windowFlags, EditorInfo attribute, + IInputContext inputContext) throws RemoteException { // TODO Auto-generated method stub - + return null; } public IBinder asBinder() { |