Merge "Fix bug 5557267 - [ViewPager] non-primary fragments unnecessary stopped if "defer start" is enabled" into ics-mr1
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index 5343e2a..5143f7f 100644
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -1145,44 +1145,29 @@
@Override
public boolean onHoverEvent(MotionEvent event) {
- // If touch exploring is enabled we ignore touch events and transform
- // the stream of hover events as touch events. This allows one consistent
- // event stream to drive the keyboard since during touch exploring the
- // first touch generates only hover events and tapping on the same
- // location generates hover and touch events.
if (mAccessibilityManager.isTouchExplorationEnabled() && event.getPointerCount() == 1) {
final int action = event.getAction();
switch (action) {
case MotionEvent.ACTION_HOVER_ENTER:
- event.setAction(MotionEvent.ACTION_DOWN);
- break;
case MotionEvent.ACTION_HOVER_MOVE:
- event.setAction(MotionEvent.ACTION_MOVE);
+ final int touchX = (int) event.getX() - mPaddingLeft;
+ int touchY = (int) event.getY() - mPaddingTop;
+ if (touchY >= -mVerticalCorrection) {
+ touchY += mVerticalCorrection;
+ }
+ final int keyIndex = getKeyIndices(touchX, touchY, null);
+ showPreview(keyIndex);
break;
case MotionEvent.ACTION_HOVER_EXIT:
- event.setAction(MotionEvent.ACTION_UP);
+ showPreview(NOT_A_KEY);
break;
}
- onTouchEventInternal(event);
- event.setAction(action);
}
- return super.onHoverEvent(event);
+ return true;
}
@Override
- public boolean onTouchEvent(MotionEvent event) {
- // If touch exploring is enabled we ignore touch events and transform
- // the stream of hover events as touch events. This allows one consistent
- // event stream to drive the keyboard since during touch exploring the
- // first touch generates only hover events and tapping on the same
- // location generates hover and touch events.
- if (mAccessibilityManager.isTouchExplorationEnabled()) {
- return true;
- }
- return onTouchEventInternal(event);
- }
-
- private boolean onTouchEventInternal(MotionEvent me) {
+ public boolean onTouchEvent(MotionEvent me) {
// Convert multi-pointer up/down events to single up/down events to
// deal with the typical multi-pointer behavior of two-thumb typing
final int pointerCount = me.getPointerCount();
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index 6df80e4..399d217 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -1187,6 +1187,8 @@
*/
@Override
public void onActionViewExpanded() {
+ if (mExpandedInActionView) return;
+
mExpandedInActionView = true;
mCollapsedImeOptions = mQueryTextView.getImeOptions();
mQueryTextView.setImeOptions(mCollapsedImeOptions | EditorInfo.IME_FLAG_NO_FULLSCREEN);
diff --git a/core/res/res/drawable/ic_lockscreen_outerring.xml b/core/res/res/drawable/ic_lockscreen_outerring.xml
index 490f370..3bdd6f6 100644
--- a/core/res/res/drawable/ic_lockscreen_outerring.xml
+++ b/core/res/res/drawable/ic_lockscreen_outerring.xml
@@ -17,7 +17,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"
>
- <size android:height="270dp" android:width="270dp" />
+ <size android:height="@dimen/keyguard_lockscreen_outerring_diameter" android:width="@dimen/keyguard_lockscreen_outerring_diameter" />
<solid android:color="#00000000" />
<stroke android:color="#1affffff" android:width="2dp" />
-</shape>
+</shape>
\ No newline at end of file
diff --git a/core/res/res/values-sw600dp/dimens.xml b/core/res/res/values-sw600dp/dimens.xml
index db94884..551c1d8 100644
--- a/core/res/res/values-sw600dp/dimens.xml
+++ b/core/res/res/values-sw600dp/dimens.xml
@@ -45,6 +45,12 @@
<!-- Size of clock font in LockScreen. -->
<dimen name="keyguard_pattern_unlock_clock_font_size">98sp</dimen>
+ <!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
+ <dimen name="keyguard_lockscreen_outerring_diameter">364dp</dimen>
+
+ <!-- target placement radius for MultiWaveView -->
+ <dimen name="multiwaveview_target_placement_radius">182dip</dimen>
+
<!-- Size of status line font in LockScreen. -->
<dimen name="keyguard_pattern_unlock_status_line_font_size">14sp</dimen>
diff --git a/core/res/res/values/arrays.xml b/core/res/res/values/arrays.xml
index ce6bbc2..f9e1f5b 100644
--- a/core/res/res/values/arrays.xml
+++ b/core/res/res/values/arrays.xml
@@ -343,8 +343,6 @@
<item>@drawable/list_divider_holo_dark</item>
<item>@drawable/list_divider_holo_light</item>
<item>@drawable/list_divider_holo_light</item>
- <item>@drawable/ic_lockscreen_handle</item>
- <item>@drawable/ic_lockscreen_outerring</item>
<item>@drawable/ic_lockscreen_chevron_left</item>
<item>@drawable/ic_lockscreen_chevron_right</item>
<item>@drawable/ab_transparent_dark_holo</item>
diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml
index 3edd5ce..fa18648 100644
--- a/core/res/res/values/dimens.xml
+++ b/core/res/res/values/dimens.xml
@@ -66,6 +66,9 @@
<!-- Default vertical gap between keys in the password keyboard (used by keyguard) -->
<dimen name="password_keyboard_verticalGap">9dip</dimen>
+ <!-- Size of lockscreen outerring on unsecure unlock LockScreen -->
+ <dimen name="keyguard_lockscreen_outerring_diameter">270dp</dimen>
+
<!-- Default target placement radius for MultiWaveView -->
<dimen name="multiwaveview_target_placement_radius">135dip</dimen>
diff --git a/docs/html/sdk/android-4.0.jd b/docs/html/sdk/android-4.0.jd
index 2ccc927..e886bdf 100644
--- a/docs/html/sdk/android-4.0.jd
+++ b/docs/html/sdk/android-4.0.jd
@@ -518,7 +518,7 @@
<p>To specify the focus or metering areas to use, simply call {@link
android.hardware.Camera.Parameters#setFocusAreas setFocusAreas()} or {@link
-android.hardware.Camera.Parameters#setFocusAreas setMeteringAreas()}. Each take a {@link
+android.hardware.Camera.Parameters#setMeteringAreas setMeteringAreas()}. Each take a {@link
java.util.List} of {@link android.hardware.Camera.Area} objects that indicate the areas to consider
for focus or metering. For example, you might implement a feature that allows the user to set the
focus area by touching an area of the preview, which you then translate to an {@link
@@ -1028,7 +1028,7 @@
<p>Android 4.0 gives users precise visibility of how much network data their applications are using.
The Settings app provides controls that allow users to manage set limits for network data usage and
even disable the use of background data for individual apps. In order to avoid users disabling your
-app’s access to data from the background, you should develop strategies to use use the data
+app’s access to data from the background, you should develop strategies to use the data
connection efficiently and adjust your usage depending on the type of connection available.</p>
<p>If your application performs a lot of network transactions, you should provide user settings that
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index ce390a0..ff67a7e 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -26,7 +26,7 @@
<drawable name="status_bar_recents_app_thumbnail_background">#88000000</drawable>
<color name="status_bar_recents_app_label_color">#ffffffff</color>
<drawable name="status_bar_notification_row_background_color">#ff090909</drawable>
- <drawable name="notification_header_bg">#d8000000</drawable>
+ <drawable name="notification_header_bg">#FF000000</drawable>
<drawable name="notification_tracking_bg">#d8000000</drawable>
<color name="notification_list_shadow_top">#80000000</color>
<drawable name="recents_callout_line">#99ffffff</drawable>
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 1107fe9..7bd29d9 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -73,7 +73,7 @@
private Context mContext;
private final static String TAG = "Tethering";
private final static boolean DBG = true;
- private final static boolean VDBG = false;
+ private final static boolean VDBG = true;
// TODO - remove both of these - should be part of interface inspection/selection stuff
private String[] mTetherableUsbRegexs;
@@ -920,6 +920,29 @@
setTethered(true);
sendTetherStateChangedBroadcast();
}
+
+ void cleanupUpstream() {
+ if (mMyUpstreamIfaceName != null) {
+ // note that we don't care about errors here.
+ // sometimes interfaces are gone before we get
+ // to remove their rules, which generates errors.
+ // just do the best we can.
+ try {
+ // about to tear down NAT; gather remaining statistics
+ mStatsService.forceUpdate();
+ } catch (Exception e) {
+ if (VDBG) Log.e(TAG, "Exception in forceUpdate: " + e.toString());
+ }
+ try {
+ mNMService.disableNat(mIfaceName, mMyUpstreamIfaceName);
+ } catch (Exception e) {
+ if (VDBG) Log.e(TAG, "Exception in disableNat: " + e.toString());
+ }
+ mMyUpstreamIfaceName = null;
+ }
+ return;
+ }
+
@Override
public boolean processMessage(Message message) {
if (VDBG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
@@ -928,23 +951,7 @@
switch (message.what) {
case CMD_TETHER_UNREQUESTED:
case CMD_INTERFACE_DOWN:
- if (mMyUpstreamIfaceName != null) {
- try {
- // about to tear down NAT; gather remaining statistics
- mStatsService.forceUpdate();
-
- mNMService.disableNat(mIfaceName, mMyUpstreamIfaceName);
- mMyUpstreamIfaceName = null;
- } catch (Exception e) {
- try {
- mNMService.untetherInterface(mIfaceName);
- } catch (Exception ee) {}
-
- setLastErrorAndTransitionToInitialState(
- ConnectivityManager.TETHER_ERROR_DISABLE_NAT_ERROR);
- break;
- }
- }
+ cleanupUpstream();
try {
mNMService.untetherInterface(mIfaceName);
} catch (Exception e) {
@@ -975,23 +982,7 @@
if (VDBG) Log.d(TAG, "Connection changed noop - dropping");
break;
}
- if (mMyUpstreamIfaceName != null) {
- try {
- // about to tear down NAT; gather remaining statistics
- mStatsService.forceUpdate();
-
- mNMService.disableNat(mIfaceName, mMyUpstreamIfaceName);
- mMyUpstreamIfaceName = null;
- } catch (Exception e) {
- try {
- mNMService.untetherInterface(mIfaceName);
- } catch (Exception ee) {}
-
- setLastErrorAndTransitionToInitialState(
- ConnectivityManager.TETHER_ERROR_DISABLE_NAT_ERROR);
- break;
- }
- }
+ cleanupUpstream();
if (newUpstreamIfaceName != null) {
try {
mNMService.enableNat(mIfaceName, newUpstreamIfaceName);
@@ -1016,23 +1007,7 @@
error = true;
// fall through
case CMD_TETHER_MODE_DEAD:
- if (mMyUpstreamIfaceName != null) {
- try {
- // about to tear down NAT; gather remaining statistics
- mStatsService.forceUpdate();
-
- mNMService.disableNat(mIfaceName, mMyUpstreamIfaceName);
- mMyUpstreamIfaceName = null;
- } catch (Exception e) {
- try {
- mNMService.untetherInterface(mIfaceName);
- } catch (Exception ee) {}
-
- setLastErrorAndTransitionToInitialState(
- ConnectivityManager.TETHER_ERROR_DISABLE_NAT_ERROR);
- break;
- }
- }
+ cleanupUpstream();
try {
mNMService.untetherInterface(mIfaceName);
} catch (Exception e) {
diff --git a/wifi/java/android/net/wifi/p2p/WifiP2pService.java b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
index 1b02774..6bb22a4 100644
--- a/wifi/java/android/net/wifi/p2p/WifiP2pService.java
+++ b/wifi/java/android/net/wifi/p2p/WifiP2pService.java
@@ -81,7 +81,7 @@
*/
public class WifiP2pService extends IWifiP2pManager.Stub {
private static final String TAG = "WifiP2pService";
- private static final boolean DBG = true;
+ private static final boolean DBG = false;
private static final String NETWORKTYPE = "WIFI_P2P";
private Context mContext;
@@ -131,12 +131,22 @@
/* User rejected to disable Wi-Fi in order to enable p2p */
private static final int WIFI_DISABLE_USER_REJECT = BASE + 5;
+ /* User accepted a group negotiation request */
+ private static final int GROUP_NEGOTIATION_USER_ACCEPT = BASE + 6;
+ /* User rejected a group negotiation request */
+ private static final int GROUP_NEGOTIATION_USER_REJECT = BASE + 7;
+
+ /* User accepted a group invitation request */
+ private static final int GROUP_INVITATION_USER_ACCEPT = BASE + 8;
+ /* User rejected a group invitation request */
+ private static final int GROUP_INVITATION_USER_REJECT = BASE + 9;
+
/* Airplane mode changed */
- private static final int AIRPLANE_MODE_CHANGED = BASE + 6;
+ private static final int AIRPLANE_MODE_CHANGED = BASE + 10;
/* Emergency callback mode */
- private static final int EMERGENCY_CALLBACK_MODE = BASE + 7;
- private static final int WPS_PBC = BASE + 8;
- private static final int WPS_PIN = BASE + 9;
+ private static final int EMERGENCY_CALLBACK_MODE = BASE + 11;
+ private static final int WPS_PBC = BASE + 12;
+ private static final int WPS_PIN = BASE + 13;
private final boolean mP2pSupported;
@@ -260,6 +270,10 @@
private P2pEnabledState mP2pEnabledState = new P2pEnabledState();
// Inactive is when p2p is enabled with no connectivity
private InactiveState mInactiveState = new InactiveState();
+ private UserAuthorizingGroupNegotiationState mUserAuthorizingGroupNegotiationState
+ = new UserAuthorizingGroupNegotiationState();
+ private UserAuthorizingGroupInvitationState mUserAuthorizingGroupInvitationState
+ = new UserAuthorizingGroupInvitationState();
private GroupNegotiationState mGroupNegotiationState = new GroupNegotiationState();
private GroupCreatedState mGroupCreatedState = new GroupCreatedState();
@@ -290,6 +304,8 @@
addState(mP2pEnablingState, mDefaultState);
addState(mP2pEnabledState, mDefaultState);
addState(mInactiveState, mP2pEnabledState);
+ addState(mUserAuthorizingGroupNegotiationState, mInactiveState);
+ addState(mUserAuthorizingGroupInvitationState, mInactiveState);
addState(mGroupNegotiationState, mP2pEnabledState);
addState(mGroupCreatedState, mP2pEnabledState);
@@ -379,6 +395,10 @@
// Ignore
case WIFI_DISABLE_USER_ACCEPT:
case WIFI_DISABLE_USER_REJECT:
+ case GROUP_NEGOTIATION_USER_ACCEPT:
+ case GROUP_NEGOTIATION_USER_REJECT:
+ case GROUP_INVITATION_USER_ACCEPT:
+ case GROUP_INVITATION_USER_REJECT:
case GROUP_NEGOTIATION_TIMED_OUT:
break;
default:
@@ -747,6 +767,7 @@
case WifiMonitor.P2P_GO_NEGOTIATION_REQUEST_EVENT:
mSavedGoNegotiationConfig = (WifiP2pConfig) message.obj;
notifyP2pGoNegotationRequest(mSavedGoNegotiationConfig);
+ transitionTo(mUserAuthorizingGroupNegotiationState);
break;
case WifiP2pManager.CREATE_GROUP:
mPersistGroup = true;
@@ -761,6 +782,7 @@
case WifiMonitor.P2P_INVITATION_RECEIVED_EVENT:
WifiP2pGroup group = (WifiP2pGroup) message.obj;
notifyP2pInvitationReceived(group);
+ transitionTo(mUserAuthorizingGroupInvitationState);
break;
default:
return NOT_HANDLED;
@@ -769,6 +791,70 @@
}
}
+ class UserAuthorizingGroupNegotiationState extends State {
+ @Override
+ public void enter() {
+ if (DBG) logd(getName());
+ }
+
+ @Override
+ public boolean processMessage(Message message) {
+ if (DBG) logd(getName() + message.toString());
+ switch (message.what) {
+ case WifiMonitor.P2P_GO_NEGOTIATION_REQUEST_EVENT:
+ case WifiMonitor.P2P_INVITATION_RECEIVED_EVENT:
+ //Ignore additional connection requests
+ break;
+ case GROUP_NEGOTIATION_USER_ACCEPT:
+ sendMessage(WifiP2pManager.CONNECT, mSavedGoNegotiationConfig);
+ mSavedGoNegotiationConfig = null;
+ break;
+ case GROUP_NEGOTIATION_USER_REJECT:
+ if (DBG) logd("User rejected incoming negotiation request");
+ mSavedGoNegotiationConfig = null;
+ transitionTo(mInactiveState);
+ break;
+ default:
+ return NOT_HANDLED;
+ }
+ return HANDLED;
+ }
+ }
+
+ class UserAuthorizingGroupInvitationState extends State {
+ @Override
+ public void enter() {
+ if (DBG) logd(getName());
+ }
+
+ @Override
+ public boolean processMessage(Message message) {
+ if (DBG) logd(getName() + message.toString());
+ switch (message.what) {
+ case WifiMonitor.P2P_GO_NEGOTIATION_REQUEST_EVENT:
+ case WifiMonitor.P2P_INVITATION_RECEIVED_EVENT:
+ //Ignore additional connection requests
+ break;
+ case GROUP_INVITATION_USER_ACCEPT:
+ if (DBG) logd(getName() + " connect to invited group");
+ WifiP2pConfig config = new WifiP2pConfig();
+ config.deviceAddress = mSavedP2pGroup.getOwner().deviceAddress;
+ sendMessage(WifiP2pManager.CONNECT, config);
+ mSavedP2pGroup = null;
+ break;
+ case GROUP_INVITATION_USER_REJECT:
+ if (DBG) logd("User rejected incoming invitation request");
+ mSavedP2pGroup = null;
+ transitionTo(mInactiveState);
+ break;
+ default:
+ return NOT_HANDLED;
+ }
+ return HANDLED;
+ }
+ }
+
+
class GroupNegotiationState extends State {
@Override
public void enter() {
@@ -1091,15 +1177,14 @@
mSavedGoNegotiationConfig.wps.setup = WpsInfo.KEYPAD;
mSavedGoNegotiationConfig.wps.pin = pin.getText().toString();
}
- sendMessage(WifiP2pManager.CONNECT, mSavedGoNegotiationConfig);
- mSavedGoNegotiationConfig = null;
+ sendMessage(GROUP_NEGOTIATION_USER_ACCEPT);
}
})
.setNegativeButton(r.getString(R.string.cancel), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (DBG) logd(getName() + " ignore connect");
- mSavedGoNegotiationConfig = null;
+ sendMessage(GROUP_NEGOTIATION_USER_REJECT);
}
})
.create();
@@ -1180,14 +1265,16 @@
.setView(textEntryView)
.setPositiveButton(r.getString(R.string.ok), new OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
- WifiP2pConfig config = new WifiP2pConfig();
- config.deviceAddress = mSavedP2pGroup.getOwner().deviceAddress;
- if (DBG) logd(getName() + " connect to invited group");
- sendMessage(WifiP2pManager.CONNECT, config);
- mSavedP2pGroup = null;
+ sendMessage(GROUP_INVITATION_USER_ACCEPT);
}
})
- .setNegativeButton(r.getString(R.string.cancel), null)
+ .setNegativeButton(r.getString(R.string.cancel), new OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ if (DBG) logd(getName() + " ignore invite");
+ sendMessage(GROUP_INVITATION_USER_REJECT);
+ }
+ })
.create();
pin.setVisibility(View.GONE);