Merge "Correct mapping for "boot-after-ota" compilation reason"
diff --git a/core/java/Android.bp b/core/java/Android.bp
index a643c29..303b3e8 100644
--- a/core/java/Android.bp
+++ b/core/java/Android.bp
@@ -170,8 +170,6 @@
"com/android/internal/util/IndentingPrintWriter.java",
"com/android/internal/util/MessageUtils.java",
"com/android/internal/util/WakeupMessage.java",
- // TODO: delete as soon as NetworkStatsFactory stops using
- "com/android/internal/util/ProcFileReader.java",
],
}
diff --git a/core/java/android/os/Parcel.java b/core/java/android/os/Parcel.java
index 9649d38..5eb4d8e 100644
--- a/core/java/android/os/Parcel.java
+++ b/core/java/android/os/Parcel.java
@@ -767,7 +767,7 @@
}
/**
- * Set the bytes in data to be the raw bytes of this Parcel.
+ * Fills the raw bytes of this Parcel with the supplied data.
*/
public final void unmarshall(@NonNull byte[] data, int offset, int length) {
nativeUnmarshall(mNativePtr, data, offset, length);
diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java
index ee32ce4..617c9c2e 100644
--- a/core/java/android/service/voice/VoiceInteractionSession.java
+++ b/core/java/android/service/voice/VoiceInteractionSession.java
@@ -84,12 +84,12 @@
/**
* An active voice interaction session, providing a facility for the implementation
- * to interact with the user in the voice interaction layer. The user interface is
- * initially shown by default, and can be created be overriding {@link #onCreateContentView()}
+ * to interact with the user in the voice interaction layer. The user interface is
+ * initially shown by default, and can be created by overriding {@link #onCreateContentView()}
* in which the UI can be built.
*
* <p>A voice interaction session can be self-contained, ultimately calling {@link #finish}
- * when done. It can also initiate voice interactions with applications by calling
+ * when done. It can also initiate voice interactions with applications by calling
* {@link #startVoiceActivity}</p>.
*/
public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCallbacks2 {
diff --git a/core/java/com/android/internal/util/OWNERS b/core/java/com/android/internal/util/OWNERS
index 354dd9a..1808bd5 100644
--- a/core/java/com/android/internal/util/OWNERS
+++ b/core/java/com/android/internal/util/OWNERS
@@ -5,3 +5,4 @@
per-file Protocol* = etancohen@google.com, lorenzo@google.com
per-file State* = jchalard@google.com, lorenzo@google.com, satk@google.com
per-file *Dump* = file:/core/java/com/android/internal/util/dump/OWNERS
+per-file *Screenshot* = file:/packages/SystemUI/src/com/android/systemui/screenshot/OWNERS
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 3622029..789e5b0 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -2127,6 +2127,8 @@
// Reset the fd to the unsolicited zygote socket
gSystemServerSocketFd = -1;
+ } else if (pid == -1) {
+ ALOGE("Failed to fork child process: %s (%d)", strerror(errno), errno);
} else {
ALOGD("Forked child process %d", pid);
}
diff --git a/core/tests/overlaytests/device/AndroidTest.xml b/core/tests/overlaytests/device/AndroidTest.xml
index 2d7d9b4..4099ec1 100644
--- a/core/tests/overlaytests/device/AndroidTest.xml
+++ b/core/tests/overlaytests/device/AndroidTest.xml
@@ -20,7 +20,7 @@
<option name="test-suite-tag" value="apct-instrumentation" />
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="remount-system" value="true" />
<option name="push" value="OverlayDeviceTests.apk->/system/app/OverlayDeviceTests.apk" />
diff --git a/core/tests/screenshothelpertests/OWNERS b/core/tests/screenshothelpertests/OWNERS
new file mode 100644
index 0000000..23dc8fb
--- /dev/null
+++ b/core/tests/screenshothelpertests/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 801321
+file:/packages/SystemUI/src/com/android/systemui/screenshot/OWNERS
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
index 58f74a0..dccd392 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java
@@ -363,11 +363,13 @@
// The ringer and rows container has extra height at the top to fit the expanded ringer
// drawer. This area should not be touchable unless the ringer drawer is open.
+ // In landscape the ringer expands to the left and it has to be ensured that if there
+ // are multiple rows they are touchable.
if (view == mTopContainer && !mIsRingerDrawerOpen) {
if (!isLandscape()) {
y += getRingerDrawerOpenExtraSize();
- } else {
- x += getRingerDrawerOpenExtraSize();
+ } else if (getRingerDrawerOpenExtraSize() > getVisibleRowsExtraSize()) {
+ x += (getRingerDrawerOpenExtraSize() - getVisibleRowsExtraSize());
}
}
@@ -1926,6 +1928,21 @@
return (mRingerCount - 1) * mRingerDrawerItemSize;
}
+ /**
+ * Return the size of the additionally visible rows next to the default stream.
+ * An additional row is visible for example while receiving a voice call.
+ */
+ private int getVisibleRowsExtraSize() {
+ VolumeRow activeRow = getActiveRow();
+ int visibleRows = 0;
+ for (final VolumeRow row : mRows) {
+ if (shouldBeVisibleH(row, activeRow)) {
+ visibleRows++;
+ }
+ }
+ return (visibleRows - 1) * (mDialogWidth + mRingerRowsPadding);
+ }
+
private void updateBackgroundForDrawerClosedAmount() {
if (mRingerAndDrawerContainerBackground == null) {
return;
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 774fe5b..16a060a 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -222,6 +222,11 @@
*/
private static final int VPN_DEFAULT_SCORE = 101;
+ /**
+ * The initial token value of IKE session.
+ */
+ private static final int STARTING_TOKEN = -1;
+
// TODO: create separate trackers for each unique VPN to support
// automated reconnection
@@ -514,12 +519,8 @@
@NonNull NetworkScore score,
@NonNull NetworkAgentConfig config,
@Nullable NetworkProvider provider) {
- return new NetworkAgent(context, looper, logTag, nc, lp, score, config, provider) {
- @Override
- public void onNetworkUnwanted() {
- // We are user controlled, not driven by NetworkRequest.
- }
- };
+ return new VpnNetworkAgentWrapper(
+ context, looper, logTag, nc, lp, score, config, provider);
}
}
@@ -785,7 +786,7 @@
}
}
- private boolean isVpnApp(String packageName) {
+ private static boolean isVpnApp(String packageName) {
return packageName != null && !VpnConfig.LEGACY_VPN.equals(packageName);
}
@@ -1813,7 +1814,7 @@
Log.wtf(TAG, "Failed to add restricted user to owner", e);
}
if (mNetworkAgent != null) {
- mNetworkAgent.sendNetworkCapabilities(mNetworkCapabilities);
+ doSendNetworkCapabilities(mNetworkAgent, mNetworkCapabilities);
}
}
setVpnForcedLocked(mLockdown);
@@ -1843,7 +1844,7 @@
Log.wtf(TAG, "Failed to remove restricted user to owner", e);
}
if (mNetworkAgent != null) {
- mNetworkAgent.sendNetworkCapabilities(mNetworkCapabilities);
+ doSendNetworkCapabilities(mNetworkAgent, mNetworkCapabilities);
}
}
setVpnForcedLocked(mLockdown);
@@ -2077,7 +2078,7 @@
return false;
}
boolean success = jniAddAddress(mInterface, address, prefixLength);
- mNetworkAgent.sendLinkProperties(makeLinkProperties());
+ doSendLinkProperties(mNetworkAgent, makeLinkProperties());
return success;
}
@@ -2086,7 +2087,7 @@
return false;
}
boolean success = jniDelAddress(mInterface, address, prefixLength);
- mNetworkAgent.sendLinkProperties(makeLinkProperties());
+ doSendLinkProperties(mNetworkAgent, makeLinkProperties());
return success;
}
@@ -2100,8 +2101,11 @@
// Make defensive copy since the content of array might be altered by the caller.
mConfig.underlyingNetworks =
(networks != null) ? Arrays.copyOf(networks, networks.length) : null;
- mNetworkAgent.setUnderlyingNetworks((mConfig.underlyingNetworks != null)
- ? Arrays.asList(mConfig.underlyingNetworks) : null);
+ doSetUnderlyingNetworks(
+ mNetworkAgent,
+ (mConfig.underlyingNetworks != null)
+ ? Arrays.asList(mConfig.underlyingNetworks)
+ : null);
return true;
}
@@ -2589,7 +2593,7 @@
}
@Nullable
- protected synchronized NetworkCapabilities getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
+ private synchronized NetworkCapabilities getRedactedNetworkCapabilities(
NetworkCapabilities nc) {
if (nc == null) return null;
return mConnectivityManager.getRedactedNetworkCapabilitiesForPackage(
@@ -2597,8 +2601,7 @@
}
@Nullable
- protected synchronized LinkProperties getRedactedLinkPropertiesOfUnderlyingNetwork(
- LinkProperties lp) {
+ private synchronized LinkProperties getRedactedLinkProperties(LinkProperties lp) {
if (lp == null) return null;
return mConnectivityManager.getRedactedLinkPropertiesForPackage(lp, mOwnerUID, mPackage);
}
@@ -2712,11 +2715,13 @@
private boolean mIsRunning = true;
/**
- * The token used by the primary/current/active IKE session.
+ * The token that identifies the most recently created IKE session.
*
- * <p>This token MUST be updated when the VPN switches to use a new IKE session.
+ * <p>This token is monotonically increasing and will never be reset in the lifetime of this
+ * Ikev2VpnRunner, but it does get reset across runs. It also MUST be accessed on the
+ * executor thread and updated when a new IKE session is created.
*/
- private int mCurrentToken = -1;
+ private int mCurrentToken = STARTING_TOKEN;
@Nullable private IpSecTunnelInterface mTunnelIface;
@Nullable private Network mActiveNetwork;
@@ -2910,7 +2915,7 @@
return; // Link properties are already sent.
} else {
// Underlying networks also set in agentConnect()
- networkAgent.setUnderlyingNetworks(Collections.singletonList(network));
+ doSetUnderlyingNetworks(networkAgent, Collections.singletonList(network));
mNetworkCapabilities =
new NetworkCapabilities.Builder(mNetworkCapabilities)
.setUnderlyingNetworks(Collections.singletonList(network))
@@ -2920,7 +2925,7 @@
lp = makeLinkProperties(); // Accesses VPN instance fields; must be locked
}
- networkAgent.sendLinkProperties(lp);
+ doSendLinkProperties(networkAgent, lp);
} catch (Exception e) {
Log.d(TAG, "Error in ChildOpened for token " + token, e);
onSessionLost(token, e);
@@ -2987,7 +2992,7 @@
new NetworkCapabilities.Builder(mNetworkCapabilities)
.setUnderlyingNetworks(Collections.singletonList(network))
.build();
- mNetworkAgent.setUnderlyingNetworks(Collections.singletonList(network));
+ doSetUnderlyingNetworks(mNetworkAgent, Collections.singletonList(network));
}
mTunnelIface.setUnderlyingNetwork(network);
@@ -3208,7 +3213,7 @@
mExecutor.schedule(
() -> {
if (isActiveToken(token)) {
- handleSessionLost(null, network);
+ handleSessionLost(null /* exception */, network);
} else {
Log.d(
TAG,
@@ -3225,7 +3230,7 @@
TimeUnit.MILLISECONDS);
} else {
Log.d(TAG, "Call handleSessionLost for losing network " + network);
- handleSessionLost(null, network);
+ handleSessionLost(null /* exception */, network);
}
}
@@ -3293,70 +3298,69 @@
// already terminated due to other failures.
cancelHandleNetworkLostTimeout();
- synchronized (Vpn.this) {
- String category = null;
- int errorClass = -1;
- int errorCode = -1;
- if (exception instanceof IkeProtocolException) {
- final IkeProtocolException ikeException = (IkeProtocolException) exception;
- category = VpnManager.CATEGORY_EVENT_IKE_ERROR;
- errorCode = ikeException.getErrorType();
+ String category = null;
+ int errorClass = -1;
+ int errorCode = -1;
+ if (exception instanceof IllegalArgumentException) {
+ // Failed to build IKE/ChildSessionParams; fatal profile configuration error
+ markFailedAndDisconnect(exception);
+ return;
+ }
- switch (ikeException.getErrorType()) {
- case IkeProtocolException.ERROR_TYPE_NO_PROPOSAL_CHOSEN: // Fallthrough
- case IkeProtocolException.ERROR_TYPE_INVALID_KE_PAYLOAD: // Fallthrough
- case IkeProtocolException.ERROR_TYPE_AUTHENTICATION_FAILED: // Fallthrough
- case IkeProtocolException.ERROR_TYPE_SINGLE_PAIR_REQUIRED: // Fallthrough
- case IkeProtocolException.ERROR_TYPE_FAILED_CP_REQUIRED: // Fallthrough
- case IkeProtocolException.ERROR_TYPE_TS_UNACCEPTABLE:
- // All the above failures are configuration errors, and are terminal
- errorClass = VpnManager.ERROR_CLASS_NOT_RECOVERABLE;
- break;
- // All other cases possibly recoverable.
- default:
- // All the above failures are configuration errors, and are terminal
- errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
- }
- } else if (exception instanceof IllegalArgumentException) {
- // Failed to build IKE/ChildSessionParams; fatal profile configuration error
- markFailedAndDisconnect(exception);
- return;
- } else if (exception instanceof IkeNetworkLostException) {
- category = VpnManager.CATEGORY_EVENT_NETWORK_ERROR;
- errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
- errorCode = VpnManager.ERROR_CODE_NETWORK_LOST;
- } else if (exception instanceof IkeNonProtocolException) {
- category = VpnManager.CATEGORY_EVENT_NETWORK_ERROR;
- errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
- if (exception.getCause() instanceof UnknownHostException) {
- errorCode = VpnManager.ERROR_CODE_NETWORK_UNKNOWN_HOST;
- } else if (exception.getCause() instanceof IkeTimeoutException) {
- errorCode = VpnManager.ERROR_CODE_NETWORK_PROTOCOL_TIMEOUT;
- } else if (exception.getCause() instanceof IOException) {
- errorCode = VpnManager.ERROR_CODE_NETWORK_IO;
- }
- } else if (exception != null) {
- Log.wtf(TAG, "onSessionLost: exception = " + exception);
+ if (exception instanceof IkeProtocolException) {
+ final IkeProtocolException ikeException = (IkeProtocolException) exception;
+ category = VpnManager.CATEGORY_EVENT_IKE_ERROR;
+ errorCode = ikeException.getErrorType();
+
+ switch (ikeException.getErrorType()) {
+ case IkeProtocolException.ERROR_TYPE_NO_PROPOSAL_CHOSEN: // Fallthrough
+ case IkeProtocolException.ERROR_TYPE_INVALID_KE_PAYLOAD: // Fallthrough
+ case IkeProtocolException.ERROR_TYPE_AUTHENTICATION_FAILED: // Fallthrough
+ case IkeProtocolException.ERROR_TYPE_SINGLE_PAIR_REQUIRED: // Fallthrough
+ case IkeProtocolException.ERROR_TYPE_FAILED_CP_REQUIRED: // Fallthrough
+ case IkeProtocolException.ERROR_TYPE_TS_UNACCEPTABLE:
+ // All the above failures are configuration errors, and are terminal
+ errorClass = VpnManager.ERROR_CLASS_NOT_RECOVERABLE;
+ break;
+ // All other cases possibly recoverable.
+ default:
+ errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
}
+ } else if (exception instanceof IkeNetworkLostException) {
+ category = VpnManager.CATEGORY_EVENT_NETWORK_ERROR;
+ errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
+ errorCode = VpnManager.ERROR_CODE_NETWORK_LOST;
+ } else if (exception instanceof IkeNonProtocolException) {
+ category = VpnManager.CATEGORY_EVENT_NETWORK_ERROR;
+ errorClass = VpnManager.ERROR_CLASS_RECOVERABLE;
+ if (exception.getCause() instanceof UnknownHostException) {
+ errorCode = VpnManager.ERROR_CODE_NETWORK_UNKNOWN_HOST;
+ } else if (exception.getCause() instanceof IkeTimeoutException) {
+ errorCode = VpnManager.ERROR_CODE_NETWORK_PROTOCOL_TIMEOUT;
+ } else if (exception.getCause() instanceof IOException) {
+ errorCode = VpnManager.ERROR_CODE_NETWORK_IO;
+ }
+ } else if (exception != null) {
+ Log.wtf(TAG, "onSessionLost: exception = " + exception);
+ }
+ synchronized (Vpn.this) {
// TODO(b/230548427): Remove SDK check once VPN related stuff are
// decoupled from ConnectivityServiceTest.
if (SdkLevel.isAtLeastT() && category != null && isVpnApp(mPackage)) {
sendEventToVpnManagerApp(category, errorClass, errorCode,
getPackage(), mSessionKey, makeVpnProfileStateLocked(),
mActiveNetwork,
- getRedactedNetworkCapabilitiesOfUnderlyingNetwork(
- mUnderlyingNetworkCapabilities),
- getRedactedLinkPropertiesOfUnderlyingNetwork(
- mUnderlyingLinkProperties));
+ getRedactedNetworkCapabilities(mUnderlyingNetworkCapabilities),
+ getRedactedLinkProperties(mUnderlyingLinkProperties));
}
+ }
- if (errorClass == VpnManager.ERROR_CLASS_NOT_RECOVERABLE) {
- markFailedAndDisconnect(exception);
- return;
- } else {
- scheduleRetryNewIkeSession();
- }
+ if (errorClass == VpnManager.ERROR_CLASS_NOT_RECOVERABLE) {
+ markFailedAndDisconnect(exception);
+ return;
+ } else {
+ scheduleRetryNewIkeSession();
}
mUnderlyingNetworkCapabilities = null;
@@ -3384,7 +3388,7 @@
null /*gateway*/, null /*iface*/, RTN_UNREACHABLE));
}
if (mNetworkAgent != null) {
- mNetworkAgent.sendLinkProperties(makeLinkProperties());
+ doSendLinkProperties(mNetworkAgent, makeLinkProperties());
}
}
}
@@ -4121,7 +4125,7 @@
.setUids(createUserAndRestrictedProfilesRanges(
mUserId, null /* allowedApplications */, excludedApps))
.build();
- mNetworkAgent.sendNetworkCapabilities(mNetworkCapabilities);
+ doSendNetworkCapabilities(mNetworkAgent, mNetworkCapabilities);
}
}
}
@@ -4198,6 +4202,85 @@
return isCurrentIkev2VpnLocked(packageName) ? makeVpnProfileStateLocked() : null;
}
+ /** Proxy to allow different testing setups */
+ // TODO: b/240492694 Remove VpnNetworkAgentWrapper and this method when
+ // NetworkAgent#sendLinkProperties can be un-finalized.
+ private static void doSendLinkProperties(
+ @NonNull NetworkAgent agent, @NonNull LinkProperties lp) {
+ if (agent instanceof VpnNetworkAgentWrapper) {
+ ((VpnNetworkAgentWrapper) agent).doSendLinkProperties(lp);
+ } else {
+ agent.sendLinkProperties(lp);
+ }
+ }
+
+ /** Proxy to allow different testing setups */
+ // TODO: b/240492694 Remove VpnNetworkAgentWrapper and this method when
+ // NetworkAgent#sendNetworkCapabilities can be un-finalized.
+ private static void doSendNetworkCapabilities(
+ @NonNull NetworkAgent agent, @NonNull NetworkCapabilities nc) {
+ if (agent instanceof VpnNetworkAgentWrapper) {
+ ((VpnNetworkAgentWrapper) agent).doSendNetworkCapabilities(nc);
+ } else {
+ agent.sendNetworkCapabilities(nc);
+ }
+ }
+
+ /** Proxy to allow different testing setups */
+ // TODO: b/240492694 Remove VpnNetworkAgentWrapper and this method when
+ // NetworkAgent#setUnderlyingNetworks can be un-finalized.
+ private static void doSetUnderlyingNetworks(
+ @NonNull NetworkAgent agent, @NonNull List<Network> networks) {
+ if (agent instanceof VpnNetworkAgentWrapper) {
+ ((VpnNetworkAgentWrapper) agent).doSetUnderlyingNetworks(networks);
+ } else {
+ agent.setUnderlyingNetworks(networks);
+ }
+ }
+
+ /**
+ * Proxy to allow testing
+ *
+ * @hide
+ */
+ // TODO: b/240492694 Remove VpnNetworkAgentWrapper when NetworkAgent's methods can be
+ // un-finalized.
+ @VisibleForTesting
+ public static class VpnNetworkAgentWrapper extends NetworkAgent {
+ /** Create an VpnNetworkAgentWrapper */
+ public VpnNetworkAgentWrapper(
+ @NonNull Context context,
+ @NonNull Looper looper,
+ @NonNull String logTag,
+ @NonNull NetworkCapabilities nc,
+ @NonNull LinkProperties lp,
+ @NonNull NetworkScore score,
+ @NonNull NetworkAgentConfig config,
+ @Nullable NetworkProvider provider) {
+ super(context, looper, logTag, nc, lp, score, config, provider);
+ }
+
+ /** Update the LinkProperties */
+ public void doSendLinkProperties(@NonNull LinkProperties lp) {
+ sendLinkProperties(lp);
+ }
+
+ /** Update the NetworkCapabilities */
+ public void doSendNetworkCapabilities(@NonNull NetworkCapabilities nc) {
+ sendNetworkCapabilities(nc);
+ }
+
+ /** Set the underlying networks */
+ public void doSetUnderlyingNetworks(@NonNull List<Network> networks) {
+ setUnderlyingNetworks(networks);
+ }
+
+ @Override
+ public void onNetworkUnwanted() {
+ // We are user controlled, not driven by NetworkRequest.
+ }
+ }
+
/**
* Proxy to allow testing
*
diff --git a/startop/view_compiler/dex_builder_test/AndroidTest.xml b/startop/view_compiler/dex_builder_test/AndroidTest.xml
index 82509b9..59093c7 100644
--- a/startop/view_compiler/dex_builder_test/AndroidTest.xml
+++ b/startop/view_compiler/dex_builder_test/AndroidTest.xml
@@ -21,7 +21,7 @@
<option name="test-file-name" value="dex-builder-test.apk" />
</target_preparer>
- <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+ <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="trivial.dex->/data/local/tmp/dex-builder-test/trivial.dex" />
<option name="push" value="simple.dex->/data/local/tmp/dex-builder-test/simple.dex" />