Merge "Improved generics on AbstractMasterSystemService / AbstractPerUserSystemService."
diff --git a/apct-tests/perftests/core/src/android/text/StaticLayoutPerfTest.java b/apct-tests/perftests/core/src/android/text/StaticLayoutPerfTest.java
index 35d3802..f60cbee6 100644
--- a/apct-tests/perftests/core/src/android/text/StaticLayoutPerfTest.java
+++ b/apct-tests/perftests/core/src/android/text/StaticLayoutPerfTest.java
@@ -169,6 +169,25 @@
}
@Test
+ public void testCreate_PrecomputedText_NoStyled_Greedy_NoHyphenation_DirDifferent() {
+ final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
+ while (state.keepRunning()) {
+ state.pauseTiming();
+ final PrecomputedText text = makeMeasured(
+ mTextUtil.nextRandomParagraph(WORD_LENGTH, NO_STYLE_TEXT), PAINT,
+ Layout.BREAK_STRATEGY_SIMPLE, Layout.HYPHENATION_FREQUENCY_NONE);
+ Canvas.freeTextLayoutCaches();
+ state.resumeTiming();
+
+ StaticLayout.Builder.obtain(text, 0, text.length(), PAINT, TEXT_WIDTH)
+ .setHyphenationFrequency(Layout.HYPHENATION_FREQUENCY_NONE)
+ .setBreakStrategy(Layout.BREAK_STRATEGY_SIMPLE)
+ .setTextDirection(TextDirectionHeuristics.RTL)
+ .build();
+ }
+ }
+
+ @Test
public void testCreate_PrecomputedText_NoStyled_Greedy_Hyphenation() {
final BenchmarkState state = mPerfStatusReporter.getBenchmarkState();
while (state.keepRunning()) {
diff --git a/api/current.txt b/api/current.txt
index b192d7f..56433f3 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -4226,8 +4226,10 @@
public class AppComponentFactory {
ctor public AppComponentFactory();
+ method public android.content.pm.ApplicationInfo getApplicationInfo();
method public android.app.Activity instantiateActivity(java.lang.ClassLoader, java.lang.String, android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
method public android.app.Application instantiateApplication(java.lang.ClassLoader, java.lang.String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+ method public java.lang.ClassLoader instantiateClassLoader(java.lang.ClassLoader);
method public android.content.ContentProvider instantiateProvider(java.lang.ClassLoader, java.lang.String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
method public android.content.BroadcastReceiver instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
method public android.app.Service instantiateService(java.lang.ClassLoader, java.lang.String, android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
diff --git a/api/system-current.txt b/api/system-current.txt
index 9fe4c2d..81a3aa1 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -4656,6 +4656,11 @@
field public static final int ID_TYPE_SERIAL = 1; // 0x1
}
+ public class DeviceIdAttestationException extends java.lang.Exception {
+ ctor public DeviceIdAttestationException(java.lang.String);
+ ctor public DeviceIdAttestationException(java.lang.String, java.lang.Throwable);
+ }
+
}
package android.security.keystore.recovery {
@@ -4863,6 +4868,7 @@
method public abstract void onStartOtaIfNecessary(int, android.service.euicc.EuiccService.OtaStatusChangedCallback);
method public abstract int onSwitchToSubscription(int, java.lang.String, boolean);
method public abstract int onUpdateSubscriptionNickname(int, java.lang.String, java.lang.String);
+ field public static final java.lang.String ACTION_BIND_CARRIER_PROVISIONING_SERVICE = "android.service.euicc.action.BIND_CARRIER_PROVISIONING_SERVICE";
field public static final java.lang.String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.service.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS";
field public static final java.lang.String ACTION_PROVISION_EMBEDDED_SUBSCRIPTION = "android.service.euicc.action.PROVISION_EMBEDDED_SUBSCRIPTION";
field public static final java.lang.String ACTION_RESOLVE_CONFIRMATION_CODE = "android.service.euicc.action.RESOLVE_CONFIRMATION_CODE";
@@ -6004,6 +6010,7 @@
field public static final int EUICC_OTA_STATUS_UNAVAILABLE = 5; // 0x5
field public static final int EUICC_OTA_SUCCEEDED = 3; // 0x3
field public static final java.lang.String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTIONS";
+ field public static final java.lang.String EXTRA_FORCE_PROVISION = "android.telephony.euicc.extra.FORCE_PROVISION";
}
public static abstract class EuiccManager.OtaStatus implements java.lang.annotation.Annotation {
@@ -6700,7 +6707,7 @@
field public static final int PROCESS_CALL_IMS = 0; // 0x0
}
- public static class MmTelFeature.MmTelCapabilities {
+ public static class MmTelFeature.MmTelCapabilities extends android.telephony.ims.feature.ImsFeature.Capabilities {
ctor public MmTelFeature.MmTelCapabilities();
ctor public deprecated MmTelFeature.MmTelCapabilities(android.telephony.ims.feature.ImsFeature.Capabilities);
ctor public MmTelFeature.MmTelCapabilities(int);
diff --git a/api/test-current.txt b/api/test-current.txt
index 5531014..1c01cf1 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -1037,6 +1037,11 @@
field public static final int ID_TYPE_SERIAL = 1; // 0x1
}
+ public class DeviceIdAttestationException extends java.lang.Exception {
+ ctor public DeviceIdAttestationException(java.lang.String);
+ ctor public DeviceIdAttestationException(java.lang.String, java.lang.Throwable);
+ }
+
public static final class KeyGenParameterSpec.Builder {
method public android.security.keystore.KeyGenParameterSpec.Builder setUniqueIdIncluded(boolean);
}
diff --git a/cmds/incidentd/src/IncidentService.cpp b/cmds/incidentd/src/IncidentService.cpp
index e92cf94..1c3ebd8 100644
--- a/cmds/incidentd/src/IncidentService.cpp
+++ b/cmds/incidentd/src/IncidentService.cpp
@@ -82,15 +82,17 @@
Status::EX_SECURITY,
"Calling process does not have permission to get local data.");
}
+ break;
case DEST_EXPLICIT:
if (callingUid != AID_SHELL && callingUid != AID_ROOT && callingUid != AID_STATSD &&
- callingUid != AID_SYSTEM) {
+ callingUid != AID_SYSTEM) {
ALOGW("Calling pid %d and uid %d does not have permission to get explicit data.",
callingPid, callingUid);
return Status::fromExceptionCode(
Status::EX_SECURITY,
"Calling process does not have permission to get explicit data.");
}
+ break;
}
return Status::ok();
}
@@ -298,7 +300,7 @@
}
return NO_ERROR;
- }
+ } break;
default: { return BnIncidentManager::onTransact(code, data, reply, flags); }
}
}
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 1108844..fa0a018 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -159,7 +159,7 @@
}
// Pulled events will start at field 10000.
- // Next: 10038
+ // Next: 10043
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000;
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -203,6 +203,7 @@
DeviceCalculatedPowerUse device_calculated_power_use = 10039;
DeviceCalculatedPowerBlameUid device_calculated_power_blame_uid = 10040;
DeviceCalculatedPowerBlameOther device_calculated_power_blame_other = 10041;
+ ProcessMemoryHighWaterMark process_memory_high_water_mark = 10042;
}
// DO NOT USE field numbers above 100,000 in AOSP.
@@ -2537,7 +2538,8 @@
// RSS high watermark.
// Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status or
// from memory.max_usage_in_bytes under /dev/memcg if the device uses per-app memory cgroups.
- optional int64 rss_high_watermark_in_bytes = 9;
+ // Deprecated: use ProcessMemoryHighWaterMark atom instead.
+ optional int64 rss_high_watermark_in_bytes = 9 [deprecated = true];
// Elapsed real time when the process started.
// Value is read from /proc/PID/stat, field 22. 0 if read from per-app memory cgroups.
@@ -2565,7 +2567,8 @@
// RSS high watermark.
// Peak RSS usage of the process. Value is read from the VmHWM field in /proc/PID/status.
- optional int64 rss_high_watermark_in_bytes = 6;
+ // Deprecated: use ProcessMemoryHighWaterMark atom instead.
+ optional int64 rss_high_watermark_in_bytes = 6 [deprecated = true];
// Elapsed real time when the process started.
// Value is read from /proc/PID/stat, field 22.
@@ -2573,6 +2576,22 @@
}
/*
+ * Logs the memory high-water mark for a process.
+ * Recorded in ActivityManagerService.
+ */
+message ProcessMemoryHighWaterMark {
+ // The uid if available. -1 means not available.
+ optional int32 uid = 1 [(is_uid) = true];
+
+ // The process name. Provided by ActivityManagerService or read from /proc/PID/cmdline.
+ optional string process_name = 2;
+
+ // RSS high-water mark. Peak RSS usage of the process. Read from the VmHWM field in
+ // /proc/PID/status.
+ optional int64 rss_high_water_mark_in_bytes = 3;
+}
+
+/*
* Elapsed real time from SystemClock.
*/
message SystemElapsedRealtime {
@@ -3357,4 +3376,4 @@
// Power used by this item in mAh, as computed by BatteryStats, since BatteryStats last reset
// (i.e. roughly since device was last significantly charged).
optional float power_milli_amp_hours = 2;
-}
\ No newline at end of file
+}
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index 0e131cb..a375dd6 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -180,6 +180,11 @@
{2, 7},
1 * NS_PER_SEC,
new StatsCompanionServicePuller(android::util::NATIVE_PROCESS_MEMORY_STATE)}},
+ {android::util::PROCESS_MEMORY_HIGH_WATER_MARK,
+ {{3},
+ {2},
+ 1 * NS_PER_SEC,
+ new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_HIGH_WATER_MARK)}},
// temperature
{android::util::TEMPERATURE, {{}, {}, 1 * NS_PER_SEC, new ResourceThermalManagerPuller()}},
// binder_calls
diff --git a/config/hiddenapi-light-greylist.txt b/config/hiddenapi-light-greylist.txt
index 39b327c..8a770b9 100644
--- a/config/hiddenapi-light-greylist.txt
+++ b/config/hiddenapi-light-greylist.txt
@@ -3568,7 +3568,6 @@
Lcom/android/internal/telephony/SubscriptionController;->getDefaultSmsSubId()I
Lcom/android/internal/telephony/SubscriptionController;->getDefaultSubId()I
Lcom/android/internal/telephony/SubscriptionController;->getDefaultVoiceSubId()I
-Lcom/android/internal/telephony/SubscriptionController;->getDummySubIds(I)[I
Lcom/android/internal/telephony/SubscriptionController;->getInstance()Lcom/android/internal/telephony/SubscriptionController;
Lcom/android/internal/telephony/SubscriptionController;->getPhoneId(I)I
Lcom/android/internal/telephony/SubscriptionController;->getSubId(I)[I
diff --git a/core/java/android/app/ActivityManagerInternal.java b/core/java/android/app/ActivityManagerInternal.java
index 0e5b976..1edd7f5 100644
--- a/core/java/android/app/ActivityManagerInternal.java
+++ b/core/java/android/app/ActivityManagerInternal.java
@@ -161,6 +161,13 @@
public abstract List<ProcessMemoryState> getMemoryStateForProcesses();
/**
+ * Returns a list that contains the memory high-water mark for currently running processes.
+ *
+ * Only processes managed by ActivityManagerService are included.
+ */
+ public abstract List<ProcessMemoryHighWaterMark> getMemoryHighWaterMarkForProcesses();
+
+ /**
* Checks to see if the calling pid is allowed to handle the user. Returns adjusted user id as
* needed.
*/
diff --git a/core/java/android/app/AppComponentFactory.java b/core/java/android/app/AppComponentFactory.java
index cfaeec9..ae63291 100644
--- a/core/java/android/app/AppComponentFactory.java
+++ b/core/java/android/app/AppComponentFactory.java
@@ -20,6 +20,7 @@
import android.content.BroadcastReceiver;
import android.content.ContentProvider;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
/**
* Interface used to control the instantiation of manifest elements.
@@ -33,6 +34,17 @@
public class AppComponentFactory {
/**
+ * Allows application to override the creation of the default class loader.
+ * This can be used to perform things such as dependency injection or setting up
+ * a custom class loader hierarchy.
+ *
+ * @param cl The default classloader instantiated by platform.
+ */
+ public @NonNull ClassLoader instantiateClassLoader(@NonNull ClassLoader cl) {
+ return cl;
+ }
+
+ /**
* Allows application to override the creation of the application object. This can be used to
* perform things such as dependency injection or class loader changes to these
* classes.
@@ -121,6 +133,19 @@
return (ContentProvider) cl.loadClass(className).newInstance();
}
+ private ApplicationInfo mApplicationInfo = null;
+
+ void setApplicationInfo(ApplicationInfo info) {
+ mApplicationInfo = info;
+ }
+
+ /**
+ * Returns the ApplicationInfo associated with this package.
+ */
+ public ApplicationInfo getApplicationInfo() {
+ return mApplicationInfo;
+ }
+
/**
* @hide
*/
diff --git a/core/java/android/app/LoadedApk.java b/core/java/android/app/LoadedApk.java
index b827d01..da4f77b 100644
--- a/core/java/android/app/LoadedApk.java
+++ b/core/java/android/app/LoadedApk.java
@@ -117,6 +117,7 @@
private File mCredentialProtectedDataDirFile;
@UnsupportedAppUsage
private final ClassLoader mBaseClassLoader;
+ private ClassLoader mDefaultClassLoader;
private final boolean mSecurityViolation;
private final boolean mIncludeCode;
private final boolean mRegisterPackage;
@@ -224,9 +225,10 @@
mSecurityViolation = false;
mIncludeCode = true;
mRegisterPackage = false;
- mClassLoader = ClassLoader.getSystemClassLoader();
mResources = Resources.getSystem();
- mAppComponentFactory = createAppFactory(mApplicationInfo, mClassLoader);
+ mDefaultClassLoader = ClassLoader.getSystemClassLoader();
+ mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader);
+ mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
}
/**
@@ -235,15 +237,21 @@
void installSystemApplicationInfo(ApplicationInfo info, ClassLoader classLoader) {
assert info.packageName.equals("android");
mApplicationInfo = info;
- mClassLoader = classLoader;
- mAppComponentFactory = createAppFactory(info, classLoader);
+ mDefaultClassLoader = classLoader;
+ mAppComponentFactory = createAppFactory(info, mDefaultClassLoader);
+ mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
}
private AppComponentFactory createAppFactory(ApplicationInfo appInfo, ClassLoader cl) {
if (appInfo.appComponentFactory != null && cl != null) {
try {
- return (AppComponentFactory) cl.loadClass(appInfo.appComponentFactory)
- .newInstance();
+ AppComponentFactory factory = (AppComponentFactory) cl.loadClass(
+ appInfo.appComponentFactory).newInstance();
+ // Pass a copy of ApplicationInfo to the factory. Copying protects the framework
+ // from apps which would override the factory and change ApplicationInfo contents.
+ // ApplicationInfo is used to set up the default class loader.
+ factory.setApplicationInfo(new ApplicationInfo(appInfo));
+ return factory;
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
Slog.e(TAG, "Unable to instantiate appComponentFactory", e);
}
@@ -357,7 +365,7 @@
getClassLoader());
}
}
- mAppComponentFactory = createAppFactory(aInfo, mClassLoader);
+ mAppComponentFactory = createAppFactory(aInfo, mDefaultClassLoader);
}
private void setApplicationInfo(ApplicationInfo aInfo) {
@@ -633,11 +641,12 @@
}
if (mBaseClassLoader != null) {
- mClassLoader = mBaseClassLoader;
+ mDefaultClassLoader = mBaseClassLoader;
} else {
- mClassLoader = ClassLoader.getSystemClassLoader();
+ mDefaultClassLoader = ClassLoader.getSystemClassLoader();
}
- mAppComponentFactory = createAppFactory(mApplicationInfo, mClassLoader);
+ mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader);
+ mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
return;
}
@@ -715,9 +724,9 @@
// call System.loadLibrary() on a classloader from a LoadedApk with
// mIncludeCode == false).
if (!mIncludeCode) {
- if (mClassLoader == null) {
+ if (mDefaultClassLoader == null) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
- mClassLoader = ApplicationLoaders.getDefault().getClassLoader(
+ mDefaultClassLoader = ApplicationLoaders.getDefault().getClassLoader(
"" /* codePath */, mApplicationInfo.targetSdkVersion, isBundledApp,
librarySearchPath, libraryPermittedPath, mBaseClassLoader,
null /* classLoaderName */);
@@ -725,6 +734,10 @@
mAppComponentFactory = AppComponentFactory.DEFAULT;
}
+ if (mClassLoader == null) {
+ mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+ }
+
return;
}
@@ -741,16 +754,16 @@
", JNI path: " + librarySearchPath);
boolean needToSetupJitProfiles = false;
- if (mClassLoader == null) {
+ if (mDefaultClassLoader == null) {
// Temporarily disable logging of disk reads on the Looper thread
// as this is early and necessary.
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
- mClassLoader = ApplicationLoaders.getDefault().getClassLoader(zip,
+ mDefaultClassLoader = ApplicationLoaders.getDefault().getClassLoader(zip,
mApplicationInfo.targetSdkVersion, isBundledApp, librarySearchPath,
libraryPermittedPath, mBaseClassLoader,
mApplicationInfo.classLoaderName);
- mAppComponentFactory = createAppFactory(mApplicationInfo, mClassLoader);
+ mAppComponentFactory = createAppFactory(mApplicationInfo, mDefaultClassLoader);
StrictMode.setThreadPolicy(oldPolicy);
// Setup the class loader paths for profiling.
@@ -761,7 +774,7 @@
// Temporarily disable logging of disk reads on the Looper thread as this is necessary
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
try {
- ApplicationLoaders.getDefault().addNative(mClassLoader, libPaths);
+ ApplicationLoaders.getDefault().addNative(mDefaultClassLoader, libPaths);
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
@@ -799,7 +812,7 @@
if (!extraLibPaths.isEmpty()) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
try {
- ApplicationLoaders.getDefault().addNative(mClassLoader, extraLibPaths);
+ ApplicationLoaders.getDefault().addNative(mDefaultClassLoader, extraLibPaths);
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
@@ -807,7 +820,7 @@
if (addedPaths != null && addedPaths.size() > 0) {
final String add = TextUtils.join(File.pathSeparator, addedPaths);
- ApplicationLoaders.getDefault().addPath(mClassLoader, add);
+ ApplicationLoaders.getDefault().addPath(mDefaultClassLoader, add);
// Setup the new code paths for profiling.
needToSetupJitProfiles = true;
}
@@ -824,6 +837,13 @@
if (needToSetupJitProfiles && !ActivityThread.isSystem()) {
setupJitProfileSupport();
}
+
+ // Call AppComponentFactory to select/create the main class loader of this app.
+ // Since this may call code in the app, mDefaultClassLoader must be fully set up
+ // before invoking the factory.
+ if (mClassLoader == null) {
+ mClassLoader = mAppComponentFactory.instantiateClassLoader(mDefaultClassLoader);
+ }
}
@UnsupportedAppUsage
diff --git a/core/java/android/app/ProcessMemoryHighWaterMark.java b/core/java/android/app/ProcessMemoryHighWaterMark.java
new file mode 100644
index 0000000..5fea8ef
--- /dev/null
+++ b/core/java/android/app/ProcessMemoryHighWaterMark.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.app;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+/**
+ * The memory high-water mark value for a process.
+ * {@hide}
+ */
+public final class ProcessMemoryHighWaterMark implements Parcelable {
+ public final int uid;
+ public final String processName;
+ public final long rssHighWaterMarkInBytes;
+
+ public ProcessMemoryHighWaterMark(int uid, String processName, long rssHighWaterMarkInBytes) {
+ this.uid = uid;
+ this.processName = processName;
+ this.rssHighWaterMarkInBytes = rssHighWaterMarkInBytes;
+ }
+
+ private ProcessMemoryHighWaterMark(Parcel in) {
+ uid = in.readInt();
+ processName = in.readString();
+ rssHighWaterMarkInBytes = in.readLong();
+ }
+
+ public static final Creator<ProcessMemoryHighWaterMark> CREATOR =
+ new Creator<ProcessMemoryHighWaterMark>() {
+ @Override
+ public ProcessMemoryHighWaterMark createFromParcel(Parcel in) {
+ return new ProcessMemoryHighWaterMark(in);
+ }
+
+ @Override
+ public ProcessMemoryHighWaterMark[] newArray(int size) {
+ return new ProcessMemoryHighWaterMark[size];
+ }
+ };
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel parcel, int flags) {
+ parcel.writeInt(uid);
+ parcel.writeString(processName);
+ parcel.writeLong(rssHighWaterMarkInBytes);
+ }
+}
diff --git a/core/java/android/app/ProcessMemoryState.java b/core/java/android/app/ProcessMemoryState.java
index d149243..9df4fff 100644
--- a/core/java/android/app/ProcessMemoryState.java
+++ b/core/java/android/app/ProcessMemoryState.java
@@ -32,6 +32,7 @@
public final long rssInBytes;
public final long cacheInBytes;
public final long swapInBytes;
+ // TODO(rslawik): Delete this field once ProcessMemoryHighWaterMark is ready.
public final long rssHighWatermarkInBytes;
public final long startTimeNanos;
diff --git a/core/java/android/hardware/location/ContextHubManager.java b/core/java/android/hardware/location/ContextHubManager.java
index 843db66..88fb3de 100644
--- a/core/java/android/hardware/location/ContextHubManager.java
+++ b/core/java/android/hardware/location/ContextHubManager.java
@@ -764,7 +764,7 @@
IContextHubClient clientProxy;
try {
- clientProxy = mService.createClient(clientInterface, hubInfo.getId());
+ clientProxy = mService.createClient(hubInfo.getId(), clientInterface);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
diff --git a/core/java/android/hardware/location/IContextHubService.aidl b/core/java/android/hardware/location/IContextHubService.aidl
index 19ed694..04cc563 100644
--- a/core/java/android/hardware/location/IContextHubService.aidl
+++ b/core/java/android/hardware/location/IContextHubService.aidl
@@ -59,7 +59,7 @@
int sendMessage(int contextHubHandle, int nanoAppHandle, in ContextHubMessage msg);
// Creates a client to send and receive messages
- IContextHubClient createClient(in IContextHubClientCallback client, int contextHubId);
+ IContextHubClient createClient(int contextHubId, in IContextHubClientCallback client);
// Creates a PendingIntent-based client to send and receive messages
IContextHubClient createPendingIntentClient(
diff --git a/core/java/android/os/ThreadLocalWorkSource.java b/core/java/android/os/ThreadLocalWorkSource.java
index 53dd460..894b1cc4 100644
--- a/core/java/android/os/ThreadLocalWorkSource.java
+++ b/core/java/android/os/ThreadLocalWorkSource.java
@@ -17,6 +17,24 @@
package android.os;
/**
+ * Tracks who triggered the work currently executed on this thread.
+ *
+ * <p>ThreadLocalWorkSource is automatically updated inside system server for incoming/outgoing
+ * binder calls and messages posted to handler threads.
+ *
+ * <p>ThreadLocalWorkSource can also be set manually if needed to refine the WorkSource.
+ *
+ * <p>Example:
+ * <ul>
+ * <li>Bluetooth process calls {@link PowerManager#isInteractive()} API on behalf of app foo.
+ * <li>ThreadLocalWorkSource will be automatically set to the UID of foo.
+ * <li>Any code on the thread handling {@link PowerManagerService#isInteractive()} can call
+ * {@link ThreadLocalWorkSource#getUid()} to blame any resource used to handle this call.
+ * <li>If a message is posted from the binder thread, the code handling the message can also call
+ * {@link ThreadLocalWorkSource#getUid()} and it will return the UID of foo since the work source is
+ * automatically propagated.
+ * </ul>
+ *
* @hide Only for use within system server.
*/
public final class ThreadLocalWorkSource {
@@ -24,24 +42,53 @@
private static final ThreadLocal<Integer> sWorkSourceUid =
ThreadLocal.withInitial(() -> UID_NONE);
- /** Returns the original work source uid. */
+ /**
+ * Returns the UID to blame for the code currently executed on this thread.
+ *
+ * <p>This UID is set automatically by common frameworks (e.g. Binder and Handler frameworks)
+ * and automatically propagated inside system server.
+ * <p>It can also be set manually using {@link #setUid(int)}.
+ */
public static int getUid() {
return sWorkSourceUid.get();
}
- /** Sets the original work source uid. */
+ /**
+ * Sets the UID to blame for the code currently executed on this thread.
+ *
+ * <p>Inside system server, this UID will be automatically propagated.
+ * <p>It will be used to attribute future resources used on this thread (e.g. binder
+ * transactions or processing handler messages) and on any other threads the UID is propagated
+ * to.
+ *
+ * @return a token that can be used to restore the state.
+ */
public static long setUid(int uid) {
final long token = getToken();
sWorkSourceUid.set(uid);
return token;
}
- /** Restores the state using the provided token. */
+ /**
+ * Restores the state using the provided token.
+ */
public static void restore(long token) {
sWorkSourceUid.set(parseUidFromToken(token));
}
- /** Clears the stored work source uid. */
+ /**
+ * Clears the stored work source uid.
+ *
+ * <p>This method should be used when we do not know who to blame. If the UID to blame is the
+ * UID of the current process, it is better to attribute the work to the current process
+ * explicitly instead of clearing the work source:
+ *
+ * <pre>
+ * ThreadLocalWorkSource.setUid(Process.myUid());
+ * </pre>
+ *
+ * @return a token that can be used to restore the state.
+ **/
public static long clear() {
return setUid(UID_NONE);
}
diff --git a/core/java/android/service/euicc/EuiccService.java b/core/java/android/service/euicc/EuiccService.java
index b87faef..49a7320 100644
--- a/core/java/android/service/euicc/EuiccService.java
+++ b/core/java/android/service/euicc/EuiccService.java
@@ -82,6 +82,13 @@
// LUI actions. These are passthroughs of the corresponding EuiccManager actions.
/**
+ * Action used to bind the carrier app and get the activation code from the carrier app. This
+ * activation code will be used to download the eSIM profile during eSIM activation flow.
+ */
+ public static final String ACTION_BIND_CARRIER_PROVISIONING_SERVICE =
+ "android.service.euicc.action.BIND_CARRIER_PROVISIONING_SERVICE";
+
+ /**
* @see android.telephony.euicc.EuiccManager#ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS
* The difference is this one is used by system to bring up the LUI.
*/
diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java
index bad26ed..0cb7c28 100644
--- a/core/java/android/util/FeatureFlagUtils.java
+++ b/core/java/android/util/FeatureFlagUtils.java
@@ -46,7 +46,7 @@
DEFAULT_FLAGS.put("settings_systemui_theme", "true");
DEFAULT_FLAGS.put("settings_dynamic_homepage", "true");
DEFAULT_FLAGS.put("settings_mobile_network_v2", "true");
- DEFAULT_FLAGS.put("settings_data_usage_v2", "false");
+ DEFAULT_FLAGS.put("settings_data_usage_v2", "true");
DEFAULT_FLAGS.put("settings_seamless_transfer", "false");
DEFAULT_FLAGS.put(HEARING_AID_SETTINGS, "false");
DEFAULT_FLAGS.put(EMERGENCY_DIAL_SHORTCUTS, "true");
diff --git a/keystore/java/android/security/keystore/DeviceIdAttestationException.java b/keystore/java/android/security/keystore/DeviceIdAttestationException.java
index e18d193..13f50b1 100644
--- a/keystore/java/android/security/keystore/DeviceIdAttestationException.java
+++ b/keystore/java/android/security/keystore/DeviceIdAttestationException.java
@@ -16,11 +16,16 @@
package android.security.keystore;
+import android.annotation.SystemApi;
+import android.annotation.TestApi;
+
/**
* Thrown when {@link AttestationUtils} is unable to attest the given device ids.
*
* @hide
*/
+@SystemApi
+@TestApi
public class DeviceIdAttestationException extends Exception {
/**
* Constructs a new {@code DeviceIdAttestationException} with the current stack trace and the
diff --git a/libs/androidfw/AssetManager2.cpp b/libs/androidfw/AssetManager2.cpp
index 9e69488..85e72cc 100644
--- a/libs/androidfw/AssetManager2.cpp
+++ b/libs/androidfw/AssetManager2.cpp
@@ -637,6 +637,7 @@
new_entry->key = new_key;
new_entry->key_pool = nullptr;
new_entry->type_pool = nullptr;
+ new_entry->style = resid;
new_entry->value.copyFrom_dtoh(map_entry->value);
status_t err = entry.dynamic_ref_table->lookupResourceValue(&new_entry->value);
if (err != NO_ERROR) {
@@ -695,6 +696,7 @@
new_entry->key_pool = nullptr;
new_entry->type_pool = nullptr;
new_entry->value.copyFrom_dtoh(map_entry->value);
+ new_entry->style = resid;
status_t err = entry.dynamic_ref_table->lookupResourceValue(&new_entry->value);
if (err != NO_ERROR) {
LOG(ERROR) << base::StringPrintf(
@@ -731,6 +733,7 @@
new_entry->key_pool = nullptr;
new_entry->type_pool = nullptr;
new_entry->value.copyFrom_dtoh(map_entry->value);
+ new_entry->style = resid;
status_t err = entry.dynamic_ref_table->lookupResourceValue(&new_entry->value);
if (err != NO_ERROR) {
LOG(ERROR) << base::StringPrintf("Failed to resolve value t=0x%02x d=0x%08x for key 0x%08x.",
diff --git a/libs/androidfw/AttributeResolution.cpp b/libs/androidfw/AttributeResolution.cpp
index f912af4..57e3491 100644
--- a/libs/androidfw/AttributeResolution.cpp
+++ b/libs/androidfw/AttributeResolution.cpp
@@ -310,7 +310,8 @@
type_set_flags = style_flags;
value = entry->value;
if (kDebugStyles) {
- ALOGI("-> From style: type=0x%x, data=0x%08x", value.dataType, value.data);
+ ALOGI("-> From style: type=0x%x, data=0x%08x, style=0x%08x", value.dataType, value.data,
+ entry->style);
}
}
}
@@ -388,7 +389,6 @@
// out_indices must NOT be nullptr.
out_indices[indices_idx] = ii;
}
-
out_values += STYLE_NUM_ENTRIES;
}
diff --git a/libs/androidfw/include/androidfw/AssetManager2.h b/libs/androidfw/include/androidfw/AssetManager2.h
index 5312b06..0d49298 100644
--- a/libs/androidfw/include/androidfw/AssetManager2.h
+++ b/libs/androidfw/include/androidfw/AssetManager2.h
@@ -49,6 +49,9 @@
Res_value value;
+ // The resource ID of the origin style associated with the given entry.
+ uint32_t style;
+
// Which ApkAssets this entry came from.
ApkAssetsCookie cookie;
diff --git a/libs/androidfw/tests/AssetManager2_test.cpp b/libs/androidfw/tests/AssetManager2_test.cpp
index f1cc569..5449a54 100644
--- a/libs/androidfw/tests/AssetManager2_test.cpp
+++ b/libs/androidfw/tests/AssetManager2_test.cpp
@@ -298,11 +298,13 @@
EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_two->entries[0].value.dataType);
EXPECT_EQ(1u, bag_two->entries[0].value.data);
EXPECT_EQ(0, bag_two->entries[0].cookie);
+ EXPECT_EQ(app::R::style::StyleOne, bag_two->entries[0].style);
// attr_two should be overridden from StyleOne by StyleTwo.
EXPECT_EQ(app::R::attr::attr_two, bag_two->entries[1].key);
EXPECT_EQ(Res_value::TYPE_STRING, bag_two->entries[1].value.dataType);
EXPECT_EQ(0, bag_two->entries[1].cookie);
+ EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[1].style);
EXPECT_EQ(std::string("string"), GetStringFromPool(assetmanager.GetStringPoolForCookie(0),
bag_two->entries[1].value.data));
@@ -312,21 +314,25 @@
EXPECT_EQ(Res_value::TYPE_ATTRIBUTE, bag_two->entries[2].value.dataType);
EXPECT_EQ(app::R::attr::attr_indirect, bag_two->entries[2].value.data);
EXPECT_EQ(0, bag_two->entries[2].cookie);
+ EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[2].style);
EXPECT_EQ(app::R::attr::attr_five, bag_two->entries[3].key);
EXPECT_EQ(Res_value::TYPE_REFERENCE, bag_two->entries[3].value.dataType);
EXPECT_EQ(app::R::string::string_one, bag_two->entries[3].value.data);
EXPECT_EQ(0, bag_two->entries[3].cookie);
+ EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[3].style);
EXPECT_EQ(app::R::attr::attr_indirect, bag_two->entries[4].key);
EXPECT_EQ(Res_value::TYPE_INT_DEC, bag_two->entries[4].value.dataType);
EXPECT_EQ(3u, bag_two->entries[4].value.data);
EXPECT_EQ(0, bag_two->entries[4].cookie);
+ EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[4].style);
EXPECT_EQ(app::R::attr::attr_empty, bag_two->entries[5].key);
EXPECT_EQ(Res_value::TYPE_NULL, bag_two->entries[5].value.dataType);
EXPECT_EQ(Res_value::DATA_NULL_EMPTY, bag_two->entries[5].value.data);
EXPECT_EQ(0, bag_two->entries[5].cookie);
+ EXPECT_EQ(app::R::style::StyleTwo, bag_two->entries[5].style);
}
TEST_F(AssetManager2Test, MergeStylesCircularDependency) {
diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java
index 9746842..7480fa0 100644
--- a/media/java/android/media/audiofx/AudioEffect.java
+++ b/media/java/android/media/audiofx/AudioEffect.java
@@ -989,7 +989,7 @@
// --------------------
/**
* The OnEnableStatusChangeListener interface defines a method called by the AudioEffect
- * when a the enabled state of the effect engine was changed by the controlling application.
+ * when the enabled state of the effect engine was changed by the controlling application.
*/
public interface OnEnableStatusChangeListener {
/**
@@ -1003,7 +1003,7 @@
/**
* The OnControlStatusChangeListener interface defines a method called by the AudioEffect
- * when a the control of the effect engine is gained or lost by the application
+ * when control of the effect engine is gained or lost by the application
*/
public interface OnControlStatusChangeListener {
/**
diff --git a/native/webview/plat_support/Android.bp b/native/webview/plat_support/Android.bp
new file mode 100644
index 0000000..d8c5ac9
--- /dev/null
+++ b/native/webview/plat_support/Android.bp
@@ -0,0 +1,43 @@
+//
+// Copyright (C) 2012 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// This package provides the system interfaces allowing WebView to render.
+
+// Native support library (libwebviewchromium_plat_support.so) - does NOT link
+// any native chromium code.
+cc_library_shared {
+ name: "libwebviewchromium_plat_support",
+
+ srcs: [
+ "draw_gl_functor.cpp",
+ "jni_entry_point.cpp",
+ "graphics_utils.cpp",
+ "graphic_buffer_impl.cpp",
+ ],
+
+ shared_libs: [
+ "libandroidfw",
+ "libandroid_runtime",
+ "libcutils",
+ "libhwui",
+ "liblog",
+ "libui",
+ "libutils",
+ ],
+
+ // To remove warnings from skia header files
+ cflags: ["-Wno-unused-parameter"],
+}
diff --git a/native/webview/plat_support/Android.mk b/native/webview/plat_support/Android.mk
deleted file mode 100644
index 6a33fe2..0000000
--- a/native/webview/plat_support/Android.mk
+++ /dev/null
@@ -1,52 +0,0 @@
-#
-# Copyright (C) 2012 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-# This package provides the system interfaces allowing WebView to render.
-
-LOCAL_PATH := $(call my-dir)
-
-# Native support library (libwebviewchromium_plat_support.so) - does NOT link
-# any native chromium code.
-include $(CLEAR_VARS)
-
-LOCAL_MODULE:= libwebviewchromium_plat_support
-
-LOCAL_SRC_FILES:= \
- draw_gl_functor.cpp \
- jni_entry_point.cpp \
- graphics_utils.cpp \
- graphic_buffer_impl.cpp \
-
-LOCAL_C_INCLUDES:= \
- external/skia/include/core \
- frameworks/base/core/jni/android/graphics \
- frameworks/native/include/ui \
-
-LOCAL_SHARED_LIBRARIES += \
- libandroid_runtime \
- liblog \
- libcutils \
- libui \
- libutils \
- libhwui \
- libandroidfw
-
-LOCAL_MODULE_TAGS := optional
-
-# To remove warnings from skia header files
-LOCAL_CFLAGS := -Wno-unused-parameter
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/native/webview/plat_support/graphics_utils.cpp b/native/webview/plat_support/graphics_utils.cpp
index 89beb75..56825ce 100644
--- a/native/webview/plat_support/graphics_utils.cpp
+++ b/native/webview/plat_support/graphics_utils.cpp
@@ -25,8 +25,8 @@
#include <cstdlib>
#include <jni.h>
#include <utils/Log.h>
+#include "android/graphics/GraphicsJNI.h"
#include "graphic_buffer_impl.h"
-#include "GraphicsJNI.h"
#include "SkCanvasStateUtils.h"
#include "SkGraphics.h"
#include "SkPicture.h"
diff --git a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
index b6ac467..50044f2 100644
--- a/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
+++ b/packages/SettingsLib/tests/robotests/src/com/android/settingslib/net/DataUsageControllerTest.java
@@ -80,7 +80,8 @@
}
@Test
- public void getHistoricalUsageLevel_noNetworkSession_shouldReturnNegative1() {
+ public void getHistoricalUsageLevel_v1_noNetworkSession_shouldReturnNegative1() {
+ FeatureFlagUtils.setEnabled(mContext, DataUsageController.DATA_USAGE_V2, false);
doReturn(null).when(mController).getSession();
assertThat(mController.getHistoricalUsageLevel(null /* template */)).isEqualTo(-1L);
@@ -88,7 +89,8 @@
}
@Test
- public void getHistoriclUsageLevel_noUsageData_shouldReturn0() {
+ public void getHistoriclUsageLevel_v1_noUsageData_shouldReturn0() {
+ FeatureFlagUtils.setEnabled(mContext, DataUsageController.DATA_USAGE_V2, false);
doReturn(mSession).when(mController).getSession();
assertThat(mController.getHistoricalUsageLevel(NetworkTemplate.buildTemplateWifiWildcard()))
@@ -97,7 +99,8 @@
}
@Test
- public void getHistoricalUsageLevel_hasUsageData_shouldReturnTotalUsage() {
+ public void getHistoricalUsageLevel_v1_hasUsageData_shouldReturnTotalUsage() {
+ FeatureFlagUtils.setEnabled(mContext, DataUsageController.DATA_USAGE_V2, false);
doReturn(mSession).when(mController).getSession();
final long receivedBytes = 743823454L;
final long transmittedBytes = 16574289L;
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
index dc4eb3b..65c5220 100644
--- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
+++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/SyncRtSurfaceTransactionApplier.java
@@ -16,12 +16,12 @@
package com.android.systemui.shared.system;
+import android.graphics.HardwareRenderer;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.view.Surface;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
-import android.view.ThreadedRenderer;
import android.view.View;
import android.view.ViewRootImpl;
@@ -52,7 +52,7 @@
if (mTargetViewRootImpl == null) {
return;
}
- mTargetViewRootImpl.registerRtFrameCallback(new ThreadedRenderer.FrameDrawingCallback() {
+ mTargetViewRootImpl.registerRtFrameCallback(new HardwareRenderer.FrameDrawingCallback() {
@Override
public void onFrameDraw(long frame) {
if (mTargetSurface == null || !mTargetSurface.isValid()) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index f7efa70..4e417ba 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -127,6 +127,7 @@
import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.MemoryStatUtil.hasMemcg;
import static com.android.server.am.MemoryStatUtil.readMemoryStatFromFilesystem;
+import static com.android.server.am.MemoryStatUtil.readRssHighWaterMarkFromProcfs;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CONFIGURATION;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH;
@@ -182,6 +183,7 @@
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
+import android.app.ProcessMemoryHighWaterMark;
import android.app.ProcessMemoryState;
import android.app.ProfilerInfo;
import android.app.WaitResult;
@@ -18760,6 +18762,7 @@
if (memoryStat == null) {
continue;
}
+ // TODO(rslawik): Delete RSS high-water mark field.
ProcessMemoryState processMemoryState =
new ProcessMemoryState(uid,
r.processName,
@@ -18778,6 +18781,20 @@
}
@Override
+ public List<ProcessMemoryHighWaterMark> getMemoryHighWaterMarkForProcesses() {
+ List<ProcessMemoryHighWaterMark> results = new ArrayList<>();
+ synchronized (mPidsSelfLocked) {
+ for (int i = 0, size = mPidsSelfLocked.size(); i < size; i++) {
+ final ProcessRecord r = mPidsSelfLocked.valueAt(i);
+ final long rssHighWaterMarkInBytes = readRssHighWaterMarkFromProcfs(r.pid);
+ results.add(new ProcessMemoryHighWaterMark(r.uid, r.processName,
+ rssHighWaterMarkInBytes));
+ }
+ }
+ return results;
+ }
+
+ @Override
public int handleIncomingUser(int callingPid, int callingUid, int userId,
boolean allowAll, int allowMode, String name, String callerPackage) {
return mUserController.handleIncomingUser(callingPid, callingUid, userId, allowAll,
diff --git a/services/core/java/com/android/server/am/MemoryStatUtil.java b/services/core/java/com/android/server/am/MemoryStatUtil.java
index 80b4f77..cc3da1c 100644
--- a/services/core/java/com/android/server/am/MemoryStatUtil.java
+++ b/services/core/java/com/android/server/am/MemoryStatUtil.java
@@ -39,38 +39,6 @@
* Static utility methods related to {@link MemoryStat}.
*/
public final class MemoryStatUtil {
- /**
- * Which native processes to create {@link MemoryStat} for.
- *
- * <p>Processes are matched by their cmdline in procfs. Example: cat /proc/pid/cmdline returns
- * /system/bin/statsd for the stats daemon.
- */
- public static final String[] MEMORY_STAT_INTERESTING_NATIVE_PROCESSES = new String[]{
- "/system/bin/statsd", // Stats daemon.
- "/system/bin/surfaceflinger",
- "/system/bin/apexd", // APEX daemon.
- "/system/bin/audioserver",
- "/system/bin/cameraserver",
- "/system/bin/drmserver",
- "/system/bin/healthd",
- "/system/bin/incidentd",
- "/system/bin/installd",
- "/system/bin/lmkd", // Low memory killer daemon.
- "/system/bin/logd",
- "media.codec",
- "media.extractor",
- "media.metrics",
- "/system/bin/mediadrmserver",
- "/system/bin/mediaserver",
- "/system/bin/performanced",
- "/system/bin/tombstoned",
- "/system/bin/traced", // Perfetto.
- "/system/bin/traced_probes", // Perfetto.
- "webview_zygote",
- "zygote",
- "zygote64",
- };
-
static final int BYTES_IN_KILOBYTE = 1024;
static final int PAGE_SIZE = 4096;
static final long JIFFY_NANOS = 1_000_000_000 / Os.sysconf(OsConstants._SC_CLK_TCK);
@@ -152,12 +120,20 @@
if (stat == null) {
return null;
}
- final String statusPath = String.format(Locale.US, PROC_STATUS_FILE_FMT, pid);
- stat.rssHighWatermarkInBytes = parseVmHWMFromProcfs(readFileContents(statusPath));
+ stat.rssHighWatermarkInBytes = readRssHighWaterMarkFromProcfs(pid);
return stat;
}
/**
+ * Reads RSS high-water mark of a process from procfs. Returns value of the VmHWM field in
+ * /proc/PID/status in bytes or 0 if not available.
+ */
+ public static long readRssHighWaterMarkFromProcfs(int pid) {
+ final String statusPath = String.format(Locale.US, PROC_STATUS_FILE_FMT, pid);
+ return parseVmHWMFromProcfs(readFileContents(statusPath));
+ }
+
+ /**
* Reads cmdline of a process from procfs.
*
* Returns content of /proc/pid/cmdline (e.g. /system/bin/statsd) or an empty string
diff --git a/services/core/java/com/android/server/location/ContextHubClientManager.java b/services/core/java/com/android/server/location/ContextHubClientManager.java
index 7293440..00b7d62 100644
--- a/services/core/java/com/android/server/location/ContextHubClientManager.java
+++ b/services/core/java/com/android/server/location/ContextHubClientManager.java
@@ -80,15 +80,15 @@
/**
* Registers a new client with the service.
*
- * @param clientCallback the callback interface of the client to register
* @param contextHubInfo the object describing the hub this client is attached to
+ * @param clientCallback the callback interface of the client to register
*
* @return the client interface
*
* @throws IllegalStateException if max number of clients have already registered
*/
/* package */ IContextHubClient registerClient(
- IContextHubClientCallback clientCallback, ContextHubInfo contextHubInfo) {
+ ContextHubInfo contextHubInfo, IContextHubClientCallback clientCallback) {
ContextHubClientBroker broker;
synchronized (this) {
short hostEndPointId = getHostEndPointId();
@@ -120,8 +120,6 @@
*
* @return the client interface
*
- * @throws IllegalArgumentException the PendingIntent was already registered for a different
- * ContextHubClient
* @throws IllegalStateException if there were too many registered clients at the service
*/
/* package */ IContextHubClient registerClient(
diff --git a/services/core/java/com/android/server/location/ContextHubService.java b/services/core/java/com/android/server/location/ContextHubService.java
index 52f1c6b..36b0342 100644
--- a/services/core/java/com/android/server/location/ContextHubService.java
+++ b/services/core/java/com/android/server/location/ContextHubService.java
@@ -173,7 +173,7 @@
for (int contextHubId : mContextHubIdToInfoMap.keySet()) {
ContextHubInfo contextHubInfo = mContextHubIdToInfoMap.get(contextHubId);
IContextHubClient client = mClientManager.registerClient(
- createDefaultClientCallback(contextHubId), contextHubInfo);
+ contextHubInfo, createDefaultClientCallback(contextHubId));
defaultClientMap.put(contextHubId, client);
try {
@@ -608,8 +608,8 @@
/**
* Creates and registers a client at the service for the specified Context Hub.
*
- * @param clientCallback the client interface to register with the service
* @param contextHubId the ID of the hub this client is attached to
+ * @param clientCallback the client interface to register with the service
* @return the generated client interface, null if registration was unsuccessful
*
* @throws IllegalArgumentException if contextHubId is not a valid ID
@@ -618,7 +618,7 @@
*/
@Override
public IContextHubClient createClient(
- IContextHubClientCallback clientCallback, int contextHubId) throws RemoteException {
+ int contextHubId, IContextHubClientCallback clientCallback) throws RemoteException {
checkPermissions();
if (!isValidContextHubId(contextHubId)) {
throw new IllegalArgumentException("Invalid context hub ID " + contextHubId);
@@ -628,7 +628,7 @@
}
ContextHubInfo contextHubInfo = mContextHubIdToInfoMap.get(contextHubId);
- return mClientManager.registerClient(clientCallback, contextHubInfo);
+ return mClientManager.registerClient(contextHubInfo, clientCallback);
}
/**
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 3050409..d2ca850 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -19,14 +19,15 @@
import static android.os.Process.getUidForPid;
import static com.android.internal.util.Preconditions.checkNotNull;
-import static com.android.server.am.MemoryStatUtil.MEMORY_STAT_INTERESTING_NATIVE_PROCESSES;
import static com.android.server.am.MemoryStatUtil.readCmdlineFromProcfs;
import static com.android.server.am.MemoryStatUtil.readMemoryStatFromProcfs;
+import static com.android.server.am.MemoryStatUtil.readRssHighWaterMarkFromProcfs;
import android.annotation.Nullable;
import android.app.ActivityManagerInternal;
import android.app.AlarmManager;
import android.app.AlarmManager.OnAlarmListener;
+import android.app.ProcessMemoryHighWaterMark;
import android.app.ProcessMemoryState;
import android.app.StatsManager;
import android.bluetooth.BluetoothActivityEnergyInfo;
@@ -165,6 +166,37 @@
*/
public static final String EXTRA_LAST_REPORT_TIME = "android.app.extra.LAST_REPORT_TIME";
public static final int DEATH_THRESHOLD = 10;
+ /**
+ * Which native processes to snapshot memory for.
+ *
+ * <p>Processes are matched by their cmdline in procfs. Example: cat /proc/pid/cmdline returns
+ * /system/bin/statsd for the stats daemon.
+ */
+ private static final String[] MEMORY_INTERESTING_NATIVE_PROCESSES = new String[]{
+ "/system/bin/statsd", // Stats daemon.
+ "/system/bin/surfaceflinger",
+ "/system/bin/apexd", // APEX daemon.
+ "/system/bin/audioserver",
+ "/system/bin/cameraserver",
+ "/system/bin/drmserver",
+ "/system/bin/healthd",
+ "/system/bin/incidentd",
+ "/system/bin/installd",
+ "/system/bin/lmkd", // Low memory killer daemon.
+ "/system/bin/logd",
+ "media.codec",
+ "media.extractor",
+ "media.metrics",
+ "/system/bin/mediadrmserver",
+ "/system/bin/mediaserver",
+ "/system/bin/performanced",
+ "/system/bin/tombstoned",
+ "/system/bin/traced", // Perfetto.
+ "/system/bin/traced_probes", // Perfetto.
+ "webview_zygote",
+ "zygote",
+ "zygote64",
+ };
static final class CompanionHandler extends Handler {
@@ -1054,7 +1086,7 @@
private void pullNativeProcessMemoryState(
int tagId, long elapsedNanos, long wallClockNanos,
List<StatsLogEventWrapper> pulledData) {
- int[] pids = getPidsForCommands(MEMORY_STAT_INTERESTING_NATIVE_PROCESSES);
+ int[] pids = getPidsForCommands(MEMORY_INTERESTING_NATIVE_PROCESSES);
for (int i = 0; i < pids.length; i++) {
int pid = pids[i];
MemoryStat memoryStat = readMemoryStatFromProcfs(pid);
@@ -1075,6 +1107,33 @@
}
}
+ private void pullProcessMemoryHighWaterMark(
+ int tagId, long elapsedNanos, long wallClockNanos,
+ List<StatsLogEventWrapper> pulledData) {
+ List<ProcessMemoryHighWaterMark> results = LocalServices.getService(
+ ActivityManagerInternal.class).getMemoryHighWaterMarkForProcesses();
+ for (ProcessMemoryHighWaterMark processMemoryHighWaterMark : results) {
+ StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
+ e.writeInt(processMemoryHighWaterMark.uid);
+ e.writeString(processMemoryHighWaterMark.processName);
+ e.writeLong(processMemoryHighWaterMark.rssHighWaterMarkInBytes);
+ pulledData.add(e);
+ }
+ int[] pids = getPidsForCommands(MEMORY_INTERESTING_NATIVE_PROCESSES);
+ for (int i = 0; i < pids.length; i++) {
+ final int pid = pids[i];
+ final int uid = getUidForPid(pid);
+ final String processName = readCmdlineFromProcfs(pid);
+ final long rssHighWaterMarkInBytes = readRssHighWaterMarkFromProcfs(pid);
+ StatsLogEventWrapper e = new StatsLogEventWrapper(tagId, elapsedNanos, wallClockNanos);
+ e.writeInt(uid);
+ e.writeString(processName);
+ e.writeLong(rssHighWaterMarkInBytes);
+ pulledData.add(e);
+ }
+ // TODO(b/119598534): Reset HWM counters here.
+ }
+
private void pullBinderCallsStats(
int tagId, long elapsedNanos, long wallClockNanos,
List<StatsLogEventWrapper> pulledData) {
@@ -1691,6 +1750,10 @@
pullNativeProcessMemoryState(tagId, elapsedNanos, wallClockNanos, ret);
break;
}
+ case StatsLog.PROCESS_MEMORY_HIGH_WATER_MARK: {
+ pullProcessMemoryHighWaterMark(tagId, elapsedNanos, wallClockNanos, ret);
+ break;
+ }
case StatsLog.BINDER_CALLS: {
pullBinderCallsStats(tagId, elapsedNanos, wallClockNanos, ret);
break;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index a6fa6bf..3200aea 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1421,8 +1421,9 @@
/**
* Get an array of Subscription Ids for specified slot Index.
- * @param slotIndex the slot Index.
- * @return subscription Ids or null if the given slot Index is not valid.
+ * @param slotIndex the slot index.
+ * @return subscription Ids or null if the given slot Index is not valid or there are no active
+ * subscriptions in the slot.
*/
@Nullable
public static int[] getSubscriptionIds(int slotIndex) {
diff --git a/telephony/java/android/telephony/euicc/EuiccManager.java b/telephony/java/android/telephony/euicc/EuiccManager.java
index b732d4d..ebf1987 100644
--- a/telephony/java/android/telephony/euicc/EuiccManager.java
+++ b/telephony/java/android/telephony/euicc/EuiccManager.java
@@ -186,6 +186,7 @@
* whether the user choses to use eUICC to set up network in SUW.
* @hide
*/
+ @SystemApi
public static final String EXTRA_FORCE_PROVISION =
"android.telephony.euicc.extra.FORCE_PROVISION";
diff --git a/telephony/java/android/telephony/ims/feature/ImsFeature.java b/telephony/java/android/telephony/ims/feature/ImsFeature.java
index 7f69f43..3f22f98 100644
--- a/telephony/java/android/telephony/ims/feature/ImsFeature.java
+++ b/telephony/java/android/telephony/ims/feature/ImsFeature.java
@@ -211,12 +211,19 @@
* Contains the capabilities defined and supported by an ImsFeature in the form of a bit mask.
* @hide
*/
+ @SystemApi // SystemApi only because it was leaked through type usage in a previous release.
public static class Capabilities {
protected int mCapabilities = 0;
+ /**
+ * @hide
+ */
public Capabilities() {
}
+ /**
+ * @hide
+ */
protected Capabilities(int capabilities) {
mCapabilities = capabilities;
}
@@ -224,6 +231,7 @@
/**
* @param capabilities Capabilities to be added to the configuration in the form of a
* bit mask.
+ * @hide
*/
public void addCapabilities(int capabilities) {
mCapabilities |= capabilities;
@@ -232,6 +240,7 @@
/**
* @param capabilities Capabilities to be removed to the configuration in the form of a
* bit mask.
+ * @hide
*/
public void removeCapabilities(int capabilities) {
mCapabilities &= ~capabilities;
@@ -239,6 +248,7 @@
/**
* @return true if all of the capabilities specified are capable.
+ * @hide
*/
public boolean isCapable(int capabilities) {
return (mCapabilities & capabilities) == capabilities;
@@ -246,6 +256,7 @@
/**
* @return a deep copy of the Capabilites.
+ * @hide
*/
public Capabilities copy() {
return new Capabilities(mCapabilities);
@@ -253,6 +264,7 @@
/**
* @return a bitmask containing the capability flags directly.
+ * @hide
*/
public int getMask() {
return mCapabilities;
diff --git a/tools/incident_section_gen/main.cpp b/tools/incident_section_gen/main.cpp
index 0cf1046..3f42275 100644
--- a/tools/incident_section_gen/main.cpp
+++ b/tools/incident_section_gen/main.cpp
@@ -21,6 +21,10 @@
#include <sstream>
#include <string>
+#ifndef FALLTHROUGH_INTENDED
+#define FALLTHROUGH_INTENDED [[fallthrough]]
+#endif
+
using namespace android;
using namespace android::os;
using namespace google::protobuf;
@@ -355,6 +359,7 @@
printPrivacy(fieldName, field, "NULL", fieldDest, fieldName + "_patterns");
break;
}
+ FALLTHROUGH_INTENDED;
// else treat string field as primitive field and goes to default
default:
if (!hasDefaultFlags[i]) printPrivacy(fieldName, field, "NULL", fieldDest, "NULL");