diff options
| -rw-r--r-- | core/java/android/os/Vibrator.java | 4 | ||||
| -rw-r--r-- | data/keyboards/AVRCP.kl | 4 | ||||
| -rw-r--r-- | docs/html/google/auth/api-client.jd | 4 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/controls/button.jd | 2 | ||||
| -rw-r--r-- | docs/html/guide/topics/ui/controls/togglebutton.jd | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wifi/WifiController.java | 12 | ||||
| -rw-r--r-- | services/core/java/com/android/server/wifi/WifiService.java | 2 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/WifiStateMachine.java | 52 |
8 files changed, 55 insertions, 27 deletions
diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java index 6650fcaaa6a7..5d55143b97ed 100644 --- a/core/java/android/os/Vibrator.java +++ b/core/java/android/os/Vibrator.java @@ -21,11 +21,11 @@ import android.content.Context; /** * Class that operates the vibrator on the device. * <p> - * If your process exits, any vibration you started with will stop. + * If your process exits, any vibration you started will stop. * </p> * * To obtain an instance of the system vibrator, call - * {@link Context#getSystemService} with {@link Context#VIBRATOR_SERVICE} as argument. + * {@link Context#getSystemService} with {@link Context#VIBRATOR_SERVICE} as the argument. */ public abstract class Vibrator { /** diff --git a/data/keyboards/AVRCP.kl b/data/keyboards/AVRCP.kl index 4c91ece3b5ef..736b43c80c4d 100644 --- a/data/keyboards/AVRCP.kl +++ b/data/keyboards/AVRCP.kl @@ -14,8 +14,8 @@ # Key layout used for Bluetooth AVRCP support. -key 200 MEDIA_PLAY_PAUSE WAKE -key 201 MEDIA_PLAY_PAUSE WAKE +key 200 MEDIA_PLAY WAKE +key 201 MEDIA_PAUSE WAKE key 166 MEDIA_STOP WAKE key 163 MEDIA_NEXT WAKE key 165 MEDIA_PREVIOUS WAKE diff --git a/docs/html/google/auth/api-client.jd b/docs/html/google/auth/api-client.jd index fda33105a35a..402a95f980d1 100644 --- a/docs/html/google/auth/api-client.jd +++ b/docs/html/google/auth/api-client.jd @@ -112,7 +112,7 @@ GoogleApiClient}</a>, you must specify an implementation for the callback interf href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html" >{@code ConnectionCallbacks}</a> and <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.OnConnectionFailedListener.html" ->{@code onConnectionFailedListener}</a>. These interfaces receive callbacks in +>{@code OnConnectionFailedListener}</a>. These interfaces receive callbacks in response to the asynchronous <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()" >{@code connect()}</a> method when the connection to Google Play services @@ -512,7 +512,7 @@ private void loadFile(String filename) { new GetFileTask().execute(filename); } -private class GetFileTask extends AsyncTask<String, Void, Void> { +private class GetFileTask extends AsyncTask<String, Void, Void> { protected void doInBackground(String filename) { Query query = new Query.Builder() .addFilter(Filters.eq(SearchableField.TITLE, filename)) diff --git a/docs/html/guide/topics/ui/controls/button.jd b/docs/html/guide/topics/ui/controls/button.jd index 41b67b7f2043..cb274ae51f25 100644 --- a/docs/html/guide/topics/ui/controls/button.jd +++ b/docs/html/guide/topics/ui/controls/button.jd @@ -113,7 +113,7 @@ android.view.View} that was clicked)</li> <h3 id="ClickListener">Using an OnClickListener</h3> -<p>You can also declare the click event handler pragmatically rather than in an XML layout. This +<p>You can also declare the click event handler programmatically rather than in an XML layout. This might be necessary if you instantiate the {@link android.widget.Button} at runtime or you need to declare the click behavior in a {@link android.app.Fragment} subclass.</p> diff --git a/docs/html/guide/topics/ui/controls/togglebutton.jd b/docs/html/guide/topics/ui/controls/togglebutton.jd index 3119cd9820b8..5e2a551bb0fa 100644 --- a/docs/html/guide/topics/ui/controls/togglebutton.jd +++ b/docs/html/guide/topics/ui/controls/togglebutton.jd @@ -99,7 +99,7 @@ android.widget.CompoundButton#toggle()} method to change the state.</p> <h3 id="ClickListener">Using an OnCheckedChangeListener</h3> -<p>You can also declare a click event handler pragmatically rather than in an XML layout. This +<p>You can also declare a click event handler programmatically rather than in an XML layout. This might be necessary if you instantiate the {@link android.widget.ToggleButton} or {@link android.widget.Switch} at runtime or you need to declare the click behavior in a {@link android.app.Fragment} subclass.</p> diff --git a/services/core/java/com/android/server/wifi/WifiController.java b/services/core/java/com/android/server/wifi/WifiController.java index a3d514e304ca..bdb0a5e27f49 100644 --- a/services/core/java/com/android/server/wifi/WifiController.java +++ b/services/core/java/com/android/server/wifi/WifiController.java @@ -152,11 +152,21 @@ class WifiController extends StateMachine { addState(mStaDisabledWithScanState, mDefaultState); addState(mApEnabledState, mDefaultState); addState(mEcmState, mDefaultState); - if (mSettingsStore.isScanAlwaysAvailable()) { + + boolean isAirplaneModeOn = mSettingsStore.isAirplaneModeOn(); + boolean isWifiEnabled = mSettingsStore.isWifiToggleEnabled(); + boolean isScanningAlwaysAvailable = mSettingsStore.isScanAlwaysAvailable(); + + log("isAirplaneModeOn = " + isAirplaneModeOn + + ", isWifiEnabled = " + isWifiEnabled + + ", isScanningAvailable = " + isScanningAlwaysAvailable); + + if (isWifiEnabled && isScanningAlwaysAvailable) { setInitialState(mStaDisabledWithScanState); } else { setInitialState(mApStaDisabledState); } + setLogRecSize(100); setLogOnlyTransitions(false); diff --git a/services/core/java/com/android/server/wifi/WifiService.java b/services/core/java/com/android/server/wifi/WifiService.java index f2efde101565..aecf9aea5b6a 100644 --- a/services/core/java/com/android/server/wifi/WifiService.java +++ b/services/core/java/com/android/server/wifi/WifiService.java @@ -870,7 +870,7 @@ public final class WifiService extends IWifiManager.Stub { public void setCountryCode(String countryCode, boolean persist) { Slog.i(TAG, "WifiService trying to set country code to " + countryCode + " with persist set to " + persist); - enforceChangePermission(); + enforceConnectivityInternalPermission(); final long token = Binder.clearCallingIdentity(); try { mWifiStateMachine.setCountryCode(countryCode, persist); diff --git a/wifi/java/android/net/wifi/WifiStateMachine.java b/wifi/java/android/net/wifi/WifiStateMachine.java index 69d3efed1ca6..cf1669cc5928 100644 --- a/wifi/java/android/net/wifi/WifiStateMachine.java +++ b/wifi/java/android/net/wifi/WifiStateMachine.java @@ -233,6 +233,10 @@ public class WifiStateMachine extends StateMachine { private DhcpStateMachine mDhcpStateMachine; private boolean mDhcpActive = false; + // Delay in switching to null country code (non-null has no delay) + private final int COUNTRY_CODE_DELAY_MS = 15000; + private final AtomicInteger mCountryCodeSequence = new AtomicInteger(); + private class InterfaceObserver extends BaseNetworkObserver { private WifiStateMachine mWifiStateMachine; @@ -1535,14 +1539,15 @@ public class WifiStateMachine extends StateMachine { * @param persist {@code true} if the setting should be remembered. */ public void setCountryCode(String countryCode, boolean persist) { - if (persist) { - mPersistedCountryCode = countryCode; - Settings.Global.putString(mContext.getContentResolver(), - Settings.Global.WIFI_COUNTRY_CODE, - countryCode); + // If it's a country code, apply immediately, + // If it's empty, delay it in case it's a momentary dropout + int countryCodeSequence = mCountryCodeSequence.incrementAndGet(); + if (TextUtils.isEmpty(countryCode)) { + sendMessageDelayed(CMD_SET_COUNTRY_CODE, countryCodeSequence, persist ? 1 : 0, + countryCode, COUNTRY_CODE_DELAY_MS); + } else { + sendMessage(CMD_SET_COUNTRY_CODE, countryCodeSequence, persist ? 1 : 0, countryCode); } - sendMessage(CMD_SET_COUNTRY_CODE, countryCode); - mWifiP2pChannel.sendMessage(WifiP2pService.SET_COUNTRY_CODE, countryCode); } /** @@ -2508,7 +2513,9 @@ public class WifiStateMachine extends StateMachine { // to the driver happened between mPersistedCountryCode getting set // and now, so simply persisting it here would mean we have sent // nothing to the driver. Send the cmd so it might be set now. - sendMessageAtFrontOfQueue(CMD_SET_COUNTRY_CODE, countryCode); + int sequenceNum = mCountryCodeSequence.incrementAndGet(); + sendMessageAtFrontOfQueue(CMD_SET_COUNTRY_CODE, + sequenceNum, 0, countryCode); } break; case CMD_SET_BATCHED_SCAN: @@ -3091,18 +3098,29 @@ public class WifiStateMachine extends StateMachine { break; case CMD_SET_COUNTRY_CODE: String country = (String) message.obj; + final boolean persist = (message.arg2 == 1); + final int sequence = message.arg1; + if (sequence != mCountryCodeSequence.get()) { + if (DBG) log("set country code ignored due to sequence num"); + break; + } if (DBG) log("set country code " + country); - if (country != null) { - country = country.toUpperCase(Locale.ROOT); - if (mLastSetCountryCode == null - || country.equals(mLastSetCountryCode) == false) { - if (mWifiNative.setCountryCode(country)) { - mLastSetCountryCode = country; - } else { - loge("Failed to set country code " + country); - } + if (persist) { + mPersistedCountryCode = country; + Settings.Global.putString(mContext.getContentResolver(), + Settings.Global.WIFI_COUNTRY_CODE, + country); + } + country = country.toUpperCase(Locale.ROOT); + if (mLastSetCountryCode == null + || country.equals(mLastSetCountryCode) == false) { + if (mWifiNative.setCountryCode(country)) { + mLastSetCountryCode = country; + } else { + loge("Failed to set country code " + country); } } + mWifiP2pChannel.sendMessage(WifiP2pService.SET_COUNTRY_CODE, country); break; case CMD_SET_FREQUENCY_BAND: int band = message.arg1; |