Merge "Add IME action to Enter editor action" into udc-dev
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index f544e40..e6d6361 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -10719,15 +10719,15 @@
public static final class PowerManager.LowPowerStandbyPortDescription {
ctor public PowerManager.LowPowerStandbyPortDescription(int, int, int);
- ctor public PowerManager.LowPowerStandbyPortDescription(int, int, int, @Nullable android.net.LinkAddress);
- method @Nullable public android.net.LinkAddress getBindAddress();
+ ctor public PowerManager.LowPowerStandbyPortDescription(int, int, int, @Nullable java.net.InetAddress);
+ method @Nullable public java.net.InetAddress getLocalAddress();
method public int getPortMatcher();
method public int getPortNumber();
method public int getProtocol();
field public static final int MATCH_PORT_LOCAL = 1; // 0x1
field public static final int MATCH_PORT_REMOTE = 2; // 0x2
- field public static final int PROTOCOL_TCP = 1; // 0x1
- field public static final int PROTOCOL_UDP = 2; // 0x2
+ field public static final int PROTOCOL_TCP = 6; // 0x6
+ field public static final int PROTOCOL_UDP = 17; // 0x11
}
public final class PowerManager.LowPowerStandbyPortsLock {
diff --git a/core/java/android/os/IPowerManager.aidl b/core/java/android/os/IPowerManager.aidl
index 80ae8a8..6f4cdce 100644
--- a/core/java/android/os/IPowerManager.aidl
+++ b/core/java/android/os/IPowerManager.aidl
@@ -104,7 +104,7 @@
int protocol;
int portMatcher;
int portNumber;
- @nullable String bindAddress;
+ @nullable byte[] localAddress;
}
@UnsupportedAppUsage
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 7fdfba4..38e331c 100644
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -32,7 +32,6 @@
import android.app.PropertyInvalidatedCache;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
-import android.net.LinkAddress;
import android.service.dreams.Sandman;
import android.sysprop.InitProperties;
import android.util.ArrayMap;
@@ -45,6 +44,8 @@
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
@@ -3259,11 +3260,11 @@
/**
* Constant to indicate the {@link LowPowerStandbyPortDescription} refers to a TCP port.
*/
- public static final int PROTOCOL_TCP = 1;
+ public static final int PROTOCOL_TCP = 6;
/**
* Constant to indicate the {@link LowPowerStandbyPortDescription} refers to a UDP port.
*/
- public static final int PROTOCOL_UDP = 2;
+ public static final int PROTOCOL_UDP = 17;
/** @hide */
@IntDef(prefix = { "MATCH_PORT_" }, value = {
@@ -3292,7 +3293,7 @@
private final int mPortMatcher;
private final int mPortNumber;
@Nullable
- private final LinkAddress mBindAddress;
+ private final InetAddress mLocalAddress;
/**
* Describes a port.
@@ -3311,7 +3312,7 @@
this.mProtocol = protocol;
this.mPortMatcher = portMatcher;
this.mPortNumber = portNumber;
- this.mBindAddress = null;
+ this.mLocalAddress = null;
}
/**
@@ -3323,16 +3324,16 @@
* ({@link #MATCH_PORT_REMOTE}), or the destination port
* ({@link #MATCH_PORT_LOCAL}).
* @param portNumber The port number to match.
- * @param bindAddress The bind address to match.
+ * @param localAddress The local address to match.
*
* @see #newLowPowerStandbyPortsLock(List)
*/
public LowPowerStandbyPortDescription(@Protocol int protocol, @PortMatcher int portMatcher,
- int portNumber, @Nullable LinkAddress bindAddress) {
+ int portNumber, @Nullable InetAddress localAddress) {
this.mProtocol = protocol;
this.mPortMatcher = portMatcher;
this.mPortNumber = portNumber;
- this.mBindAddress = bindAddress;
+ this.mLocalAddress = localAddress;
}
private String protocolToString(int protocol) {
@@ -3398,8 +3399,8 @@
* @see #getProtocol()
*/
@Nullable
- public LinkAddress getBindAddress() {
- return mBindAddress;
+ public InetAddress getLocalAddress() {
+ return mLocalAddress;
}
@Override
@@ -3408,7 +3409,7 @@
+ "mProtocol=" + protocolToString(mProtocol)
+ ", mPortMatcher=" + portMatcherToString(mPortMatcher)
+ ", mPortNumber=" + mPortNumber
- + ", mBindAddress=" + mBindAddress
+ + ", mLocalAddress=" + mLocalAddress
+ '}';
}
@@ -3418,13 +3419,13 @@
if (!(o instanceof LowPowerStandbyPortDescription)) return false;
LowPowerStandbyPortDescription that = (LowPowerStandbyPortDescription) o;
return mProtocol == that.mProtocol && mPortMatcher == that.mPortMatcher
- && mPortNumber == that.mPortNumber && Objects.equals(mBindAddress,
- that.mBindAddress);
+ && mPortNumber == that.mPortNumber && Objects.equals(mLocalAddress,
+ that.mLocalAddress);
}
@Override
public int hashCode() {
- return Objects.hash(mProtocol, mPortMatcher, mPortNumber, mBindAddress);
+ return Objects.hash(mProtocol, mPortMatcher, mPortNumber, mLocalAddress);
}
/** @hide */
@@ -3439,8 +3440,8 @@
parcelablePortDescription.protocol = portDescription.mProtocol;
parcelablePortDescription.portMatcher = portDescription.mPortMatcher;
parcelablePortDescription.portNumber = portDescription.mPortNumber;
- if (portDescription.mBindAddress != null) {
- parcelablePortDescription.bindAddress = portDescription.mBindAddress.toString();
+ if (portDescription.mLocalAddress != null) {
+ parcelablePortDescription.localAddress = portDescription.mLocalAddress.getAddress();
}
return parcelablePortDescription;
}
@@ -3466,15 +3467,19 @@
return null;
}
- LinkAddress bindAddress = null;
- if (parcelablePortDescription.bindAddress != null) {
- bindAddress = new LinkAddress(parcelablePortDescription.bindAddress);
+ InetAddress localAddress = null;
+ if (parcelablePortDescription.localAddress != null) {
+ try {
+ localAddress = InetAddress.getByAddress(parcelablePortDescription.localAddress);
+ } catch (UnknownHostException e) {
+ Log.w(TAG, "Address has invalid length", e);
+ }
}
return new LowPowerStandbyPortDescription(
parcelablePortDescription.protocol,
parcelablePortDescription.portMatcher,
parcelablePortDescription.portNumber,
- bindAddress);
+ localAddress);
}
/** @hide */
diff --git a/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java b/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
index ad47773..369e8f1 100644
--- a/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
+++ b/services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java
@@ -16,13 +16,12 @@
package com.android.server.policy;
-import static android.view.KeyEvent.KEYCODE_A;
import static android.view.KeyEvent.KEYCODE_ALT_LEFT;
import static android.view.KeyEvent.KEYCODE_B;
import static android.view.KeyEvent.KEYCODE_C;
import static android.view.KeyEvent.KEYCODE_CTRL_LEFT;
import static android.view.KeyEvent.KEYCODE_E;
-import static android.view.KeyEvent.KEYCODE_L;
+import static android.view.KeyEvent.KEYCODE_K;
import static android.view.KeyEvent.KEYCODE_M;
import static android.view.KeyEvent.KEYCODE_META_LEFT;
import static android.view.KeyEvent.KEYCODE_N;
@@ -31,6 +30,7 @@
import static android.view.KeyEvent.KEYCODE_SLASH;
import static android.view.KeyEvent.KEYCODE_SPACE;
import static android.view.KeyEvent.KEYCODE_TAB;
+import static android.view.KeyEvent.KEYCODE_U;
import static android.view.KeyEvent.KEYCODE_Z;
import android.content.Intent;
@@ -42,11 +42,11 @@
public class ModifierShortcutTests extends ShortcutKeyTestBase {
private static final SparseArray<String> META_SHORTCUTS = new SparseArray<>();
static {
- META_SHORTCUTS.append(KEYCODE_A, Intent.CATEGORY_APP_CALCULATOR);
+ META_SHORTCUTS.append(KEYCODE_U, Intent.CATEGORY_APP_CALCULATOR);
META_SHORTCUTS.append(KEYCODE_B, Intent.CATEGORY_APP_BROWSER);
META_SHORTCUTS.append(KEYCODE_C, Intent.CATEGORY_APP_CONTACTS);
META_SHORTCUTS.append(KEYCODE_E, Intent.CATEGORY_APP_EMAIL);
- META_SHORTCUTS.append(KEYCODE_L, Intent.CATEGORY_APP_CALENDAR);
+ META_SHORTCUTS.append(KEYCODE_K, Intent.CATEGORY_APP_CALENDAR);
META_SHORTCUTS.append(KEYCODE_M, Intent.CATEGORY_APP_MAPS);
META_SHORTCUTS.append(KEYCODE_P, Intent.CATEGORY_APP_MUSIC);
META_SHORTCUTS.append(KEYCODE_S, Intent.CATEGORY_APP_MESSAGING);
diff --git a/services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java b/services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java
index a76b82b..6e7e005 100644
--- a/services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java
+++ b/services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java
@@ -237,6 +237,7 @@
overrideLaunchAccessibility();
doReturn(false).when(mPhoneWindowManager).keyguardOn();
doNothing().when(mContext).startActivityAsUser(any(), any());
+ Mockito.reset(mContext);
}
void tearDown() {
@@ -399,8 +400,12 @@
void assertLaunchCategory(String category) {
waitForIdle();
ArgumentCaptor<Intent> intentCaptor = ArgumentCaptor.forClass(Intent.class);
- verify(mContext).startActivityAsUser(intentCaptor.capture(), any());
- Assert.assertTrue(intentCaptor.getValue().getSelector().hasCategory(category));
+ try {
+ verify(mContext).startActivityAsUser(intentCaptor.capture(), any());
+ Assert.assertTrue(intentCaptor.getValue().getSelector().hasCategory(category));
+ } catch (Throwable t) {
+ throw new AssertionError("failed to assert " + category, t);
+ }
// Reset verifier for next call.
Mockito.reset(mContext);
}