Merge "Extract an "ArrayMapWithHistory" support class"
diff --git a/Android.bp b/Android.bp
index 561166e..ec37937 100644
--- a/Android.bp
+++ b/Android.bp
@@ -460,6 +460,7 @@
installable: false, // this lib is a build-only library
static_libs: [
"framework-minus-apex",
+ "updatable_media_stubs",
"framework-sdkext-stubs-systemapi",
// TODO(jiyong): add more stubs for APEXes here
],
diff --git a/api/system-current.txt b/api/system-current.txt
index 62c2d79..01cab53 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1573,6 +1573,7 @@
field public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
field public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED";
field public static final String ACTION_DEVICE_CUSTOMIZATION_READY = "android.intent.action.DEVICE_CUSTOMIZATION_READY";
+ field public static final String ACTION_DIAL_EMERGENCY = "android.intent.action.DIAL_EMERGENCY";
field public static final String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET";
field public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON";
field public static final String ACTION_INCIDENT_REPORT_READY = "android.intent.action.INCIDENT_REPORT_READY";
@@ -7839,6 +7840,7 @@
method public void addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
method @Deprecated public void clearAccounts();
method public void clearPhoneAccounts();
+ method @NonNull public android.content.Intent createLaunchEmergencyDialerIntent(@Nullable String);
method @RequiresPermission(android.Manifest.permission.DUMP) public android.telecom.TelecomAnalytics dumpAnalytics();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enablePhoneAccount(android.telecom.PhoneAccountHandle, boolean);
method public java.util.List<android.telecom.PhoneAccountHandle> getAllPhoneAccountHandles();
@@ -8445,6 +8447,24 @@
field public static final String MBMS_STREAMING_SERVICE_ACTION = "android.telephony.action.EmbmsStreaming";
}
+ public final class ModemActivityInfo implements android.os.Parcelable {
+ ctor public ModemActivityInfo(long, int, int, @NonNull int[], int);
+ method public int describeContents();
+ method public int getIdleTimeMillis();
+ method public int getReceiveTimeMillis();
+ method public int getSleepTimeMillis();
+ method public long getTimestamp();
+ method @NonNull public java.util.List<android.telephony.ModemActivityInfo.TransmitPower> getTransmitPowerInfo();
+ method public void writeToParcel(@NonNull android.os.Parcel, int);
+ field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ModemActivityInfo> CREATOR;
+ field public static final int TX_POWER_LEVELS = 5; // 0x5
+ }
+
+ public class ModemActivityInfo.TransmitPower {
+ method @NonNull public android.util.Range<java.lang.Integer> getPowerRangeInDbm();
+ method public int getTimeInMillis();
+ }
+
public final class NetworkRegistrationInfo implements android.os.Parcelable {
method public int describeContents();
method public int getAccessNetworkTechnology();
diff --git a/cmds/incidentd/src/WorkDirectory.cpp b/cmds/incidentd/src/WorkDirectory.cpp
index 7e7c642..9963533 100644
--- a/cmds/incidentd/src/WorkDirectory.cpp
+++ b/cmds/incidentd/src/WorkDirectory.cpp
@@ -666,7 +666,7 @@
clock_gettime(CLOCK_REALTIME, &spec);
timestampNs = int64_t(spec.tv_sec) * 1000 + spec.tv_nsec;
} while (file_exists_locked(timestampNs));
- return timestampNs;
+ return (timestampNs >= 0)? timestampNs : -timestampNs;
}
/**
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 4440bf8..c923156 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -3957,7 +3957,7 @@
// rx time in ms at power level 5
optional uint64 controller_rx_time_millis = 9;
// product of current(mA), voltage(V) and time(ms)
- optional uint64 energy_used = 10;
+ optional uint64 energy_used = 10 [deprecated=true];
}
/**
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e9a4762..a6867ff 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1134,6 +1134,18 @@
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY";
/**
+ * Activity Action: Dial a emergency number specified by the data. This shows a
+ * UI with the number being dialed, allowing the user to explicitly
+ * initiate the call.
+ * <p>Input: If nothing, an empty emergency dialer is started; else {@link #getData}
+ * is a tel: URI of an explicit emergency phone number.
+ * <p>Output: nothing.
+ * @hide
+ */
+ @SystemApi
+ @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
+ public static final String ACTION_DIAL_EMERGENCY = "android.intent.action.DIAL_EMERGENCY";
+ /**
* Activity action: Perform a call to any number (emergency or not)
* specified by the data.
* <p>Input: {@link #getData} is URI of a phone number to be dialed or a
diff --git a/core/java/android/os/Debug.java b/core/java/android/os/Debug.java
index bf26a41..422761c 100644
--- a/core/java/android/os/Debug.java
+++ b/core/java/android/os/Debug.java
@@ -2503,4 +2503,27 @@
* @hide
*/
public static native long getZramFreeKb();
+
+ /**
+ * Return memory size in kilobytes allocated for ION heaps.
+ *
+ * @hide
+ */
+ public static native long getIonHeapsSizeKb();
+
+ /**
+ * Return memory size in kilobytes allocated for ION pools.
+ *
+ * @hide
+ */
+ public static native long getIonPoolsSizeKb();
+
+ /**
+ * Return ION memory mapped by processes in kB.
+ * Notes:
+ * * Warning: Might impact performance as it reads /proc/<pid>/maps files for each process.
+ *
+ * @hide
+ */
+ public static native long getIonMappedSizeKb();
}
diff --git a/core/java/android/os/VintfObject.java b/core/java/android/os/VintfObject.java
index 1c78b08..7af8f71 100644
--- a/core/java/android/os/VintfObject.java
+++ b/core/java/android/os/VintfObject.java
@@ -17,6 +17,7 @@
package android.os;
import android.annotation.TestApi;
+import android.util.Slog;
import java.util.Map;
@@ -28,6 +29,8 @@
@TestApi
public class VintfObject {
+ private static final String LOG_TAG = "VintfObject";
+
/**
* Slurps all device information (both manifests and both matrices)
* and report them.
@@ -46,12 +49,33 @@
* @param packageInfo a list of serialized form of HalManifest's /
* CompatibilityMatri'ces (XML).
* @return = 0 if success (compatible)
- * > 0 if incompatible
- * < 0 if any error (mount partition fails, illformed XML, etc.)
+ * > 0 if incompatible
+ * < 0 if any error (mount partition fails, illformed XML, etc.)
+ *
+ * @deprecated Checking compatibility against an OTA package is no longer
+ * supported because the format of VINTF metadata in the OTA package may not
+ * be recognized by the current system.
+ *
+ * <p>
+ * <ul>
+ * <li>This function always returns 0 for non-empty {@code packageInfo}.
+ * </li>
+ * <li>This function returns the result of {@link #verifyWithoutAvb} for
+ * null or empty {@code packageInfo}.</li>
+ * </ul>
*
* @hide
*/
- public static native int verify(String[] packageInfo);
+ @Deprecated
+ public static int verify(String[] packageInfo) {
+ if (packageInfo != null && packageInfo.length > 0) {
+ Slog.w(LOG_TAG, "VintfObject.verify() with non-empty packageInfo is deprecated. "
+ + "Skipping compatibility checks for update package.");
+ return 0;
+ }
+ Slog.w(LOG_TAG, "VintfObject.verify() is deprecated. Call verifyWithoutAvb() instead.");
+ return verifyWithoutAvb();
+ }
/**
* Verify Vintf compatibility on the device without checking AVB
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index c859f11..3bd0fd2 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -61,6 +61,7 @@
import android.telephony.CellSignalStrength;
import android.telephony.DataConnectionRealTimeInfo;
import android.telephony.ModemActivityInfo;
+import android.telephony.ModemActivityInfo.TransmitPower;
import android.telephony.ServiceState;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
@@ -10978,7 +10979,7 @@
}
private ModemActivityInfo mLastModemActivityInfo =
- new ModemActivityInfo(0, 0, 0, new int[0], 0, 0);
+ new ModemActivityInfo(0, 0, 0, new int[0], 0);
private ModemActivityInfo getDeltaModemActivityInfo(ModemActivityInfo activityInfo) {
if (activityInfo == null) {
@@ -10986,15 +10987,14 @@
}
int[] txTimeMs = new int[ModemActivityInfo.TX_POWER_LEVELS];
for (int i = 0; i < ModemActivityInfo.TX_POWER_LEVELS; i++) {
- txTimeMs[i] = activityInfo.getTxTimeMillis()[i]
- - mLastModemActivityInfo.getTxTimeMillis()[i];
+ txTimeMs[i] = activityInfo.getTransmitPowerInfo().get(i).getTimeInMillis()
+ - mLastModemActivityInfo.getTransmitPowerInfo().get(i).getTimeInMillis();
}
ModemActivityInfo deltaInfo = new ModemActivityInfo(activityInfo.getTimestamp(),
activityInfo.getSleepTimeMillis() - mLastModemActivityInfo.getSleepTimeMillis(),
activityInfo.getIdleTimeMillis() - mLastModemActivityInfo.getIdleTimeMillis(),
txTimeMs,
- activityInfo.getRxTimeMillis() - mLastModemActivityInfo.getRxTimeMillis(),
- activityInfo.getEnergyUsed() - mLastModemActivityInfo.getEnergyUsed());
+ activityInfo.getReceiveTimeMillis() - mLastModemActivityInfo.getReceiveTimeMillis());
mLastModemActivityInfo = activityInfo;
return deltaInfo;
}
@@ -11037,10 +11037,11 @@
deltaInfo.getIdleTimeMillis());
mModemActivity.getSleepTimeCounter().addCountLocked(
deltaInfo.getSleepTimeMillis());
- mModemActivity.getRxTimeCounter().addCountLocked(deltaInfo.getRxTimeMillis());
+ mModemActivity.getRxTimeCounter().addCountLocked(deltaInfo.getReceiveTimeMillis());
for (int lvl = 0; lvl < ModemActivityInfo.TX_POWER_LEVELS; lvl++) {
mModemActivity.getTxTimeCounters()[lvl]
- .addCountLocked(deltaInfo.getTxTimeMillis()[lvl]);
+ .addCountLocked(deltaInfo.getTransmitPowerInfo()
+ .get(lvl).getTimeInMillis());
}
// POWER_MODEM_CONTROLLER_OPERATING_VOLTAGE is measured in mV, so convert to V.
@@ -11052,13 +11053,14 @@
mPowerProfile.getAveragePower(PowerProfile.POWER_MODEM_CONTROLLER_SLEEP)
+ deltaInfo.getIdleTimeMillis() *
mPowerProfile.getAveragePower(PowerProfile.POWER_MODEM_CONTROLLER_IDLE)
- + deltaInfo.getRxTimeMillis() *
+ + deltaInfo.getReceiveTimeMillis() *
mPowerProfile.getAveragePower(PowerProfile.POWER_MODEM_CONTROLLER_RX);
- int[] txTimeMs = deltaInfo.getTxTimeMillis();
- for (int i = 0; i < Math.min(txTimeMs.length,
- CellSignalStrength.getNumSignalStrengthLevels()); i++) {
- energyUsed += txTimeMs[i] * mPowerProfile.getAveragePower(
- PowerProfile.POWER_MODEM_CONTROLLER_TX, i);
+
+ List<TransmitPower> txPowerInfo = deltaInfo.getTransmitPowerInfo();
+ for (int i = 0; i < Math.min(txPowerInfo.size(),
+ SignalStrength.NUM_SIGNAL_STRENGTH_BINS); i++) {
+ energyUsed += txPowerInfo.get(i).getTimeInMillis() * mPowerProfile
+ .getAveragePower(PowerProfile.POWER_MODEM_CONTROLLER_TX, i);
}
// We store the power drain as mAms.
@@ -11147,15 +11149,16 @@
ControllerActivityCounterImpl activityCounter =
u.getOrCreateModemControllerActivityLocked();
if (totalRxPackets > 0 && entry.rxPackets > 0) {
- final long rxMs = (entry.rxPackets * deltaInfo.getRxTimeMillis())
- / totalRxPackets;
+ final long rxMs = (entry.rxPackets
+ * deltaInfo.getReceiveTimeMillis()) / totalRxPackets;
activityCounter.getRxTimeCounter().addCountLocked(rxMs);
}
if (totalTxPackets > 0 && entry.txPackets > 0) {
for (int lvl = 0; lvl < ModemActivityInfo.TX_POWER_LEVELS; lvl++) {
long txMs =
- entry.txPackets * deltaInfo.getTxTimeMillis()[lvl];
+ entry.txPackets * deltaInfo.getTransmitPowerInfo()
+ .get(lvl).getTimeInMillis();
txMs /= totalTxPackets;
activityCounter.getTxTimeCounters()[lvl].addCountLocked(txMs);
}
@@ -11186,15 +11189,16 @@
if (activityInfo == null) {
return;
}
- int[] txTimeMs = activityInfo.getTxTimeMillis();
- if (txTimeMs == null || txTimeMs.length != ModemActivityInfo.TX_POWER_LEVELS) {
+ List<TransmitPower> txPowerInfo = activityInfo.getTransmitPowerInfo();
+ if (txPowerInfo == null || txPowerInfo.size() != ModemActivityInfo.TX_POWER_LEVELS) {
return;
}
final long elapsedRealtime = mClocks.elapsedRealtime();
final long uptime = mClocks.uptimeMillis();
int levelMaxTimeSpent = 0;
- for (int i = 1; i < txTimeMs.length; i++) {
- if (txTimeMs[i] > txTimeMs[levelMaxTimeSpent]) {
+ for (int i = 1; i < txPowerInfo.size(); i++) {
+ if (txPowerInfo.get(i).getTimeInMillis() > txPowerInfo.get(levelMaxTimeSpent)
+ .getTimeInMillis()) {
levelMaxTimeSpent = i;
}
}
diff --git a/core/java/com/android/internal/util/MemInfoReader.java b/core/java/com/android/internal/util/MemInfoReader.java
index c1d129b..362bc92 100644
--- a/core/java/com/android/internal/util/MemInfoReader.java
+++ b/core/java/com/android/internal/util/MemInfoReader.java
@@ -91,7 +91,15 @@
* that are mapped in to processes.
*/
public long getCachedSizeKb() {
- return mInfos[Debug.MEMINFO_BUFFERS] + mInfos[Debug.MEMINFO_SLAB_RECLAIMABLE]
+ long kReclaimable = mInfos[Debug.MEMINFO_KRECLAIMABLE];
+
+ // Note: MEMINFO_KRECLAIMABLE includes MEMINFO_SLAB_RECLAIMABLE and ION pools.
+ // Fall back to using MEMINFO_SLAB_RECLAIMABLE in case of older kernels that do
+ // not include KReclaimable meminfo field.
+ if (kReclaimable == 0) {
+ kReclaimable = mInfos[Debug.MEMINFO_SLAB_RECLAIMABLE];
+ }
+ return mInfos[Debug.MEMINFO_BUFFERS] + kReclaimable
+ mInfos[Debug.MEMINFO_CACHED] - mInfos[Debug.MEMINFO_MAPPED];
}
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 49c029c..f68fd57 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -233,6 +233,7 @@
static_libs: [
"libasync_safe",
+ "libdmabufinfo",
"libgif",
"libseccomp_policy",
"libgrallocusage",
diff --git a/core/jni/android_os_Debug.cpp b/core/jni/android_os_Debug.cpp
index 6aed1e8..1ff28fe 100644
--- a/core/jni/android_os_Debug.cpp
+++ b/core/jni/android_os_Debug.cpp
@@ -43,6 +43,7 @@
#include <nativehelper/JNIHelp.h>
#include <nativehelper/ScopedUtfChars.h>
#include "jni.h"
+#include <dmabufinfo/dmabufinfo.h>
#include <meminfo/procmeminfo.h>
#include <meminfo/sysmeminfo.h>
#include <memtrack/memtrack.h>
@@ -779,6 +780,59 @@
return zramFreeKb;
}
+static jlong android_os_Debug_getIonHeapsSizeKb(JNIEnv* env, jobject clazz) {
+ jlong heapsSizeKb = 0;
+ uint64_t size;
+
+ if (meminfo::ReadIonHeapsSizeKb(&size)) {
+ heapsSizeKb = size;
+ }
+
+ return heapsSizeKb;
+}
+
+static jlong android_os_Debug_getIonPoolsSizeKb(JNIEnv* env, jobject clazz) {
+ jlong poolsSizeKb = 0;
+ uint64_t size;
+
+ if (meminfo::ReadIonPoolsSizeKb(&size)) {
+ poolsSizeKb = size;
+ }
+
+ return poolsSizeKb;
+}
+
+static jlong android_os_Debug_getIonMappedSizeKb(JNIEnv* env, jobject clazz) {
+ jlong ionPss = 0;
+ std::vector<dmabufinfo::DmaBuffer> dmabufs;
+
+ std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir("/proc"), closedir);
+ if (!dir) {
+ LOG(ERROR) << "Failed to open /proc directory";
+ return false;
+ }
+
+ struct dirent* dent;
+ while ((dent = readdir(dir.get()))) {
+ if (dent->d_type != DT_DIR) continue;
+
+ int pid = atoi(dent->d_name);
+ if (pid == 0) {
+ continue;
+ }
+
+ if (!AppendDmaBufInfo(pid, &dmabufs, false)) {
+ LOG(ERROR) << "Failed to read maps for pid " << pid;
+ }
+ }
+
+ for (dmabufinfo::DmaBuffer buf : dmabufs) {
+ ionPss += buf.size() / 1024;
+ }
+
+ return ionPss;
+}
+
/*
* JNI registration.
*/
@@ -822,6 +876,12 @@
(void*)android_os_Debug_getUnreachableMemory },
{ "getZramFreeKb", "()J",
(void*)android_os_Debug_getFreeZramKb },
+ { "getIonHeapsSizeKb", "()J",
+ (void*)android_os_Debug_getIonHeapsSizeKb },
+ { "getIonPoolsSizeKb", "()J",
+ (void*)android_os_Debug_getIonPoolsSizeKb },
+ { "getIonMappedSizeKb", "()J",
+ (void*)android_os_Debug_getIonMappedSizeKb },
};
int register_android_os_Debug(JNIEnv *env)
diff --git a/core/jni/android_os_VintfObject.cpp b/core/jni/android_os_VintfObject.cpp
index ee11b61..25ffbab 100644
--- a/core/jni/android_os_VintfObject.cpp
+++ b/core/jni/android_os_VintfObject.cpp
@@ -96,28 +96,9 @@
return toJavaStringArray(env, cStrings);
}
-static jint android_os_VintfObject_verify(JNIEnv* env, jclass, jobjectArray packageInfo) {
- std::vector<std::string> cPackageInfo;
- if (packageInfo) {
- size_t count = env->GetArrayLength(packageInfo);
- cPackageInfo.resize(count);
- for (size_t i = 0; i < count; ++i) {
- jstring element = (jstring)env->GetObjectArrayElement(packageInfo, i);
- const char *cString = env->GetStringUTFChars(element, NULL /* isCopy */);
- cPackageInfo[i] = cString;
- env->ReleaseStringUTFChars(element, cString);
- }
- }
- std::string error;
- int32_t status = VintfObject::CheckCompatibility(cPackageInfo, &error);
- if (status)
- LOG(WARNING) << "VintfObject.verify() returns " << status << ": " << error;
- return status;
-}
-
static jint android_os_VintfObject_verifyWithoutAvb(JNIEnv* env, jclass) {
std::string error;
- int32_t status = VintfObject::CheckCompatibility({}, &error,
+ int32_t status = VintfObject::GetInstance()->checkCompatibility(&error,
::android::vintf::CheckFlags::DISABLE_AVB_CHECK);
if (status)
LOG(WARNING) << "VintfObject.verifyWithoutAvb() returns " << status << ": " << error;
@@ -170,7 +151,6 @@
static const JNINativeMethod gVintfObjectMethods[] = {
{"report", "()[Ljava/lang/String;", (void*)android_os_VintfObject_report},
- {"verify", "([Ljava/lang/String;)I", (void*)android_os_VintfObject_verify},
{"verifyWithoutAvb", "()I", (void*)android_os_VintfObject_verifyWithoutAvb},
{"getHalNamesAndVersions", "()[Ljava/lang/String;", (void*)android_os_VintfObject_getHalNamesAndVersions},
{"getSepolicyVersion", "()Ljava/lang/String;", (void*)android_os_VintfObject_getSepolicyVersion},
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index b516c41..a404e2e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3538,6 +3538,9 @@
<!-- emergency call number for the emergency affordance -->
<string name="config_emergency_call_number" translatable="false">112</string>
+ <!-- Package name that provides Emergency Dialer -->
+ <string name="config_emergency_dialer_package">com.android.phone</string>
+
<!-- Do not translate. Mcc codes whose existence trigger the presence of emergency
affordances-->
<integer-array name="config_emergency_mcc_codes" translatable="false">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5cd5c8c..2507787 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3153,6 +3153,7 @@
<java-symbol type="string" name="global_action_emergency" />
<java-symbol type="string" name="config_emergency_call_number" />
+ <java-symbol type="string" name="config_emergency_dialer_package" />
<java-symbol type="array" name="config_emergency_mcc_codes" />
<java-symbol type="string" name="config_dozeDoubleTapSensorType" />
diff --git a/libs/androidfw/OWNERS b/libs/androidfw/OWNERS
index 87b1467..8cffd6a 100644
--- a/libs/androidfw/OWNERS
+++ b/libs/androidfw/OWNERS
@@ -3,3 +3,4 @@
rtmitchell@google.com
per-file CursorWindow.cpp=omakoto@google.com
+per-file LocaleDataTables.cpp=vichang@google.com,tobiast@google.com,nikitai@google.com
diff --git a/media/jni/android_media_MediaExtractor.h b/media/jni/android_media_MediaExtractor.h
index baa779c..f5ba92e 100644
--- a/media/jni/android_media_MediaExtractor.h
+++ b/media/jni/android_media_MediaExtractor.h
@@ -19,7 +19,7 @@
#include <media/stagefright/foundation/ABase.h>
#include <media/stagefright/foundation/AudioPresentationInfo.h>
-#include <media/MediaSource.h>
+#include <media/stagefright/MediaSource.h>
#include <media/DataSource.h>
#include <utils/Errors.h>
#include <utils/KeyedVector.h>
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 35774ed..1c4f1e3 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -12799,14 +12799,31 @@
pw.println(totalPss - cachedPss);
}
}
- long lostRAM = memInfo.getTotalSizeKb() - (totalPss - totalSwapPss)
+ long kernelUsed = memInfo.getKernelUsedSizeKb();
+ final long ionHeap = Debug.getIonHeapsSizeKb();
+ if (ionHeap > 0) {
+ final long ionMapped = Debug.getIonMappedSizeKb();
+ final long ionUnmapped = ionHeap - ionMapped;
+ final long ionPool = Debug.getIonPoolsSizeKb();
+ pw.print(" ION: ");
+ pw.print(stringifyKBSize(ionHeap + ionPool));
+ pw.print(" (");
+ pw.print(stringifyKBSize(ionMapped));
+ pw.print(" mapped + ");
+ pw.print(stringifyKBSize(ionUnmapped));
+ pw.print(" unmapped + ");
+ pw.print(stringifyKBSize(ionPool));
+ pw.println(" pools)");
+ kernelUsed += ionUnmapped;
+ }
+ final long lostRAM = memInfo.getTotalSizeKb() - (totalPss - totalSwapPss)
- memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
- - memInfo.getKernelUsedSizeKb() - memInfo.getZramTotalSizeKb();
+ - kernelUsed - memInfo.getZramTotalSizeKb();
if (!opts.isCompact) {
pw.print(" Used RAM: "); pw.print(stringifyKBSize(totalPss - cachedPss
- + memInfo.getKernelUsedSizeKb())); pw.print(" (");
+ + kernelUsed)); pw.print(" (");
pw.print(stringifyKBSize(totalPss - cachedPss)); pw.print(" used pss + ");
- pw.print(stringifyKBSize(memInfo.getKernelUsedSizeKb())); pw.print(" kernel)\n");
+ pw.print(stringifyKBSize(kernelUsed)); pw.print(" kernel)\n");
pw.print(" Lost RAM: "); pw.println(stringifyKBSize(lostRAM));
} else {
pw.print("lostram,"); pw.println(lostRAM);
@@ -13525,14 +13542,25 @@
memInfoBuilder.append(stringifyKBSize(cachedPss + memInfo.getCachedSizeKb()
+ memInfo.getFreeSizeKb()));
memInfoBuilder.append("\n");
+ long kernelUsed = memInfo.getKernelUsedSizeKb();
+ final long ionHeap = Debug.getIonHeapsSizeKb();
+ if (ionHeap > 0) {
+ final long ionMapped = Debug.getIonMappedSizeKb();
+ final long ionUnmapped = ionHeap - ionMapped;
+ final long ionPool = Debug.getIonPoolsSizeKb();
+ memInfoBuilder.append(" ION: ");
+ memInfoBuilder.append(stringifyKBSize(ionHeap + ionPool));
+ memInfoBuilder.append("\n");
+ kernelUsed += ionUnmapped;
+ }
memInfoBuilder.append(" Used RAM: ");
memInfoBuilder.append(stringifyKBSize(
- totalPss - cachedPss + memInfo.getKernelUsedSizeKb()));
+ totalPss - cachedPss + kernelUsed));
memInfoBuilder.append("\n");
memInfoBuilder.append(" Lost RAM: ");
memInfoBuilder.append(stringifyKBSize(memInfo.getTotalSizeKb()
- (totalPss - totalSwapPss) - memInfo.getFreeSizeKb() - memInfo.getCachedSizeKb()
- - memInfo.getKernelUsedSizeKb() - memInfo.getZramTotalSizeKb()));
+ - kernelUsed - memInfo.getZramTotalSizeKb()));
memInfoBuilder.append("\n");
Slog.i(TAG, "Low on memory:");
Slog.i(TAG, shortNativeBuilder.toString());
diff --git a/services/core/java/com/android/server/audio/AudioDeviceInventory.java b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
index 135f199d..4a5a212 100644
--- a/services/core/java/com/android/server/audio/AudioDeviceInventory.java
+++ b/services/core/java/com/android/server/audio/AudioDeviceInventory.java
@@ -195,15 +195,17 @@
} else {
makeA2dpDeviceUnavailableNow(address, di.mDeviceCodecFormat);
}
+ } else if (state == BluetoothProfile.STATE_CONNECTED) {
+ // device is not already connected
+ if (a2dpVolume != -1) {
+ mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC,
+ // convert index to internal representation in VolumeStreamState
+ a2dpVolume * 10,
+ AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, "onSetA2dpSinkConnectionState");
+ }
+ makeA2dpDeviceAvailable(address, BtHelper.getName(btDevice),
+ "onSetA2dpSinkConnectionState", a2dpCodec);
}
- if (a2dpVolume != -1) {
- mDeviceBroker.postSetVolumeIndexOnDevice(AudioSystem.STREAM_MUSIC,
- // convert index to internal representation in VolumeStreamState
- a2dpVolume * 10,
- AudioSystem.DEVICE_OUT_BLUETOOTH_A2DP, "onSetA2dpSinkConnectionState");
- }
- makeA2dpDeviceAvailable(address, BtHelper.getName(btDevice),
- "onSetA2dpSinkConnectionState", a2dpCodec);
}
}
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index c76bbb0..0d28b46 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -1112,13 +1112,12 @@
e.writeLong(modemInfo.getTimestamp());
e.writeLong(modemInfo.getSleepTimeMillis());
e.writeLong(modemInfo.getIdleTimeMillis());
- e.writeLong(modemInfo.getTxTimeMillis()[0]);
- e.writeLong(modemInfo.getTxTimeMillis()[1]);
- e.writeLong(modemInfo.getTxTimeMillis()[2]);
- e.writeLong(modemInfo.getTxTimeMillis()[3]);
- e.writeLong(modemInfo.getTxTimeMillis()[4]);
- e.writeLong(modemInfo.getRxTimeMillis());
- e.writeLong(modemInfo.getEnergyUsed());
+ e.writeLong(modemInfo.getTransmitPowerInfo().get(0).getTimeInMillis());
+ e.writeLong(modemInfo.getTransmitPowerInfo().get(1).getTimeInMillis());
+ e.writeLong(modemInfo.getTransmitPowerInfo().get(2).getTimeInMillis());
+ e.writeLong(modemInfo.getTransmitPowerInfo().get(3).getTimeInMillis());
+ e.writeLong(modemInfo.getTransmitPowerInfo().get(4).getTimeInMillis());
+ e.writeLong(modemInfo.getReceiveTimeMillis());
pulledData.add(e);
}
}
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 8f62bcb..af3c55a 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2056,6 +2056,29 @@
return result;
}
+
+ /**
+ * Creates the {@link Intent} which can be used with {@link Context#startActivity(Intent)} to
+ * launch the activity for emergency dialer.
+ *
+ * @param number Optional number to call in emergency dialer
+ * @hide
+ */
+ @SystemApi
+ @NonNull
+ public Intent createLaunchEmergencyDialerIntent(@Nullable String number) {
+ ITelecomService service = getTelecomService();
+ Intent result = null;
+ if (service != null) {
+ try {
+ result = service.createLaunchEmergencyDialerIntent(number);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error createLaunchEmergencyDialerIntent", e);
+ }
+ }
+ return result;
+ }
+
/**
* Determines whether Telecom would permit an incoming call to be added via the
* {@link #addNewIncomingCall(PhoneAccountHandle, Bundle)} API for the specified
diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
index cedc4b9..204c37e 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -266,6 +266,11 @@
**/
Intent createManageBlockedNumbersIntent();
+ /**
+ * @see TelecomServiceImpl#createLaunchEmergencyDialerIntent
+ */
+ Intent createLaunchEmergencyDialerIntent(in String number);
+
/**
* @see TelecomServiceImpl#isIncomingCallPermitted
*/
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 0388580..f222c50 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -854,13 +854,6 @@
"always_show_emergency_alert_onoff_bool";
/**
- * The flag to disable cell broadcast severe alert when extreme alert is disabled.
- * @hide
- */
- public static final String KEY_DISABLE_SEVERE_WHEN_EXTREME_DISABLED_BOOL =
- "disable_severe_when_extreme_disabled_bool";
-
- /**
* The data call retry configuration for different types of APN.
* @hide
*/
@@ -3492,7 +3485,6 @@
sDefaults.putStringArray(KEY_APN_SETTINGS_DEFAULT_APN_TYPES_STRING_ARRAY, null);
sDefaults.putBoolean(KEY_BROADCAST_EMERGENCY_CALL_STATE_CHANGES_BOOL, false);
sDefaults.putBoolean(KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL, false);
- sDefaults.putBoolean(KEY_DISABLE_SEVERE_WHEN_EXTREME_DISABLED_BOOL, true);
sDefaults.putStringArray(KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS, new String[]{
"default:default_randomization=2000,5000,10000,20000,40000,80000:5000,160000:5000,"
+ "320000:5000,640000:5000,1280000:5000,1800000:5000",
diff --git a/telephony/java/android/telephony/ModemActivityInfo.java b/telephony/java/android/telephony/ModemActivityInfo.java
index a0af392..aee7cca 100644
--- a/telephony/java/android/telephony/ModemActivityInfo.java
+++ b/telephony/java/android/telephony/ModemActivityInfo.java
@@ -16,43 +16,65 @@
package android.telephony;
+import android.annotation.NonNull;
+import android.annotation.SystemApi;
import android.os.Parcel;
import android.os.Parcelable;
+import android.os.SystemClock;
+import android.util.Range;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
/**
- * Reports modem activity information
+ * Reports modem activity information.
* @hide
*/
-public class ModemActivityInfo implements Parcelable {
+@SystemApi
+public final class ModemActivityInfo implements Parcelable {
/**
- * Tx power index
- * index 0 = tx_power < 0dBm
- * index 1 = 0dBm < tx_power < 5dBm
- * index 2 = 5dBm < tx_power < 15dBm
- * index 3 = 15dBm < tx_power < 20dBm
- * index 4 = tx_power > 20dBm
+ * Tx(transmit) power level. see power index below
+ * <ul>
+ * <li> index 0 = tx_power < 0dBm. </li>
+ * <li> index 1 = 0dBm < tx_power < 5dBm. </li>
+ * <li> index 2 = 5dBm < tx_power < 15dBm. </li>
+ * <li> index 3 = 15dBm < tx_power < 20dBm. </li>
+ * <li> index 4 = tx_power > 20dBm. </li>
+ * </ul>
*/
public static final int TX_POWER_LEVELS = 5;
+ private static final Range<Integer>[] TX_POWER_RANGES = new Range[] {
+ new Range<>(Integer.MIN_VALUE, 0),
+ new Range<>(0, 5),
+ new Range<>(5, 15),
+ new Range<>(15, 20),
+ new Range<>(20, Integer.MAX_VALUE)
+
+ };
private long mTimestamp;
private int mSleepTimeMs;
private int mIdleTimeMs;
- private int [] mTxTimeMs = new int[TX_POWER_LEVELS];
+ private List<TransmitPower> mTransmitPowerInfo = new ArrayList<>(TX_POWER_LEVELS);
private int mRxTimeMs;
- private int mEnergyUsed;
public ModemActivityInfo(long timestamp, int sleepTimeMs, int idleTimeMs,
- int[] txTimeMs, int rxTimeMs, int energyUsed) {
+ @NonNull int[] txTimeMs, int rxTimeMs) {
mTimestamp = timestamp;
mSleepTimeMs = sleepTimeMs;
mIdleTimeMs = idleTimeMs;
if (txTimeMs != null) {
- System.arraycopy(txTimeMs, 0, mTxTimeMs, 0, Math.min(txTimeMs.length, TX_POWER_LEVELS));
+ populateTransmitPowerRange(txTimeMs);
}
mRxTimeMs = rxTimeMs;
- mEnergyUsed = energyUsed;
+ }
+
+ /** helper API to populate tx power range for each bucket **/
+ private void populateTransmitPowerRange(@NonNull int[] transmitPowerMs) {
+ for (int i = 0; i < Math.min(transmitPowerMs.length, TX_POWER_LEVELS); i++) {
+ mTransmitPowerInfo.add(i, new TransmitPower(TX_POWER_RANGES[i], transmitPowerMs[i]));
+ }
}
@Override
@@ -61,9 +83,8 @@
+ " mTimestamp=" + mTimestamp
+ " mSleepTimeMs=" + mSleepTimeMs
+ " mIdleTimeMs=" + mIdleTimeMs
- + " mTxTimeMs[]=" + Arrays.toString(mTxTimeMs)
+ + " mTransmitPowerInfo[]=" + mTransmitPowerInfo.toString()
+ " mRxTimeMs=" + mRxTimeMs
- + " mEnergyUsed=" + mEnergyUsed
+ "}";
}
@@ -82,9 +103,8 @@
txTimeMs[i] = in.readInt();
}
int rxTimeMs = in.readInt();
- int energyUsed = in.readInt();
return new ModemActivityInfo(timestamp, sleepTimeMs, idleTimeMs,
- txTimeMs, rxTimeMs, energyUsed);
+ txTimeMs, rxTimeMs);
}
public ModemActivityInfo[] newArray(int size) {
@@ -92,107 +112,158 @@
}
};
- public void writeToParcel(Parcel dest, int flags) {
+ public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeLong(mTimestamp);
dest.writeInt(mSleepTimeMs);
dest.writeInt(mIdleTimeMs);
for (int i = 0; i < TX_POWER_LEVELS; i++) {
- dest.writeInt(mTxTimeMs[i]);
+ dest.writeInt(mTransmitPowerInfo.get(i).getTimeInMillis());
}
dest.writeInt(mRxTimeMs);
- dest.writeInt(mEnergyUsed);
}
/**
- * @return timestamp of record creation
+ * @return milliseconds since boot, including mTimeInMillis spent in sleep.
+ * @see SystemClock#elapsedRealtime()
*/
public long getTimestamp() {
return mTimestamp;
}
+ /** @hide */
public void setTimestamp(long timestamp) {
mTimestamp = timestamp;
}
/**
- * @return tx time in ms. It's an array of tx times
- * with each index...
+ * @return an arrayList of {@link TransmitPower} with each element representing the total time where
+ * transmitter is awake time (in ms) for a given power range (in dbm).
+ *
+ * @see #TX_POWER_LEVELS
*/
- public int [] getTxTimeMillis() {
- return mTxTimeMs;
+ @NonNull
+ public List<TransmitPower> getTransmitPowerInfo() {
+ return mTransmitPowerInfo;
}
- public void setTxTimeMillis(int[] txTimeMs) {
- mTxTimeMs = txTimeMs;
+ /** @hide */
+ public void setTransmitTimeMillis(int[] txTimeMs) {
+ populateTransmitPowerRange(txTimeMs);
+ }
+
+ /** @hide */
+ @NonNull
+ public int[] getTransmitTimeMillis() {
+ int[] transmitTimeMillis = new int[TX_POWER_LEVELS];
+ for (int i = 0; i < transmitTimeMillis.length; i++) {
+ transmitTimeMillis[i] = mTransmitPowerInfo.get(i).getTimeInMillis();
+ }
+ return transmitTimeMillis;
}
/**
- * @return sleep time in ms.
+ * @return total mTimeInMillis (in ms) when modem is in a low power or sleep state.
*/
public int getSleepTimeMillis() {
return mSleepTimeMs;
}
+ /** @hide */
public void setSleepTimeMillis(int sleepTimeMillis) {
mSleepTimeMs = sleepTimeMillis;
}
/**
- * @return idle time in ms.
+ * @return total mTimeInMillis (in ms) when modem is awake but neither the transmitter nor receiver are
+ * active.
*/
public int getIdleTimeMillis() {
return mIdleTimeMs;
}
+ /** @hide */
public void setIdleTimeMillis(int idleTimeMillis) {
mIdleTimeMs = idleTimeMillis;
}
/**
- * @return rx time in ms.
+ * @return rx(receive) mTimeInMillis in ms.
*/
- public int getRxTimeMillis() {
+ public int getReceiveTimeMillis() {
return mRxTimeMs;
}
- public void setRxTimeMillis(int rxTimeMillis) {
+ /** @hide */
+ public void setReceiveTimeMillis(int rxTimeMillis) {
mRxTimeMs = rxTimeMillis;
}
/**
- * product of current(mA), voltage(V) and time(ms)
- * @return energy used
- */
- public int getEnergyUsed () {
- return mEnergyUsed;
- }
-
- public void setEnergyUsed(int energyUsed) {
- mEnergyUsed = energyUsed;
- }
-
- /**
- * @return if the record is valid
+ * @return {@code true} if this {@link ModemActivityInfo} record is valid,
+ * {@code false} otherwise.
+ *
+ * @hide
*/
public boolean isValid() {
- for (int txVal : getTxTimeMillis()) {
- if(txVal < 0) {
+ for (TransmitPower powerInfo : getTransmitPowerInfo()) {
+ if(powerInfo.getTimeInMillis() < 0) {
return false;
}
}
return ((getIdleTimeMillis() >= 0) && (getSleepTimeMillis() >= 0)
- && (getRxTimeMillis() >= 0) && (getEnergyUsed() >= 0) && !isEmpty());
+ && (getReceiveTimeMillis() >= 0) && !isEmpty());
}
private boolean isEmpty() {
- for (int txVal : getTxTimeMillis()) {
- if(txVal != 0) {
+ for (TransmitPower txVal : getTransmitPowerInfo()) {
+ if(txVal.getTimeInMillis() != 0) {
return false;
}
}
return ((getIdleTimeMillis() == 0) && (getSleepTimeMillis() == 0)
- && (getRxTimeMillis() == 0) && (getEnergyUsed() == 0));
+ && (getReceiveTimeMillis() == 0));
+ }
+
+ /**
+ * Transmit power Information, including the power range in dbm and the total time (in ms) where
+ * the transmitter is active/awake for this power range.
+ * e.g, range: 0dbm(lower) ~ 5dbm(upper)
+ * time: 5ms
+ */
+ public class TransmitPower {
+ private int mTimeInMillis;
+ private Range<Integer> mPowerRangeInDbm;
+ /** @hide */
+ public TransmitPower(@NonNull Range<Integer> range, int time) {
+ this.mTimeInMillis = time;
+ this.mPowerRangeInDbm = range;
+ }
+
+ /**
+ * @return the total time in ms where the transmitter is active/wake for this power range
+ * {@link #getPowerRangeInDbm()}.
+ */
+ public int getTimeInMillis() {
+ return mTimeInMillis;
+ }
+
+ /**
+ * @return the power range in dbm. e.g, range: 0dbm(lower) ~ 5dbm(upper)
+ */
+ @NonNull
+ public Range<Integer> getPowerRangeInDbm() {
+ return mPowerRangeInDbm;
+ }
+
+ @Override
+ public String toString() {
+ return "TransmitPower{"
+ + " mTimeInMillis=" + mTimeInMillis
+ + " mPowerRangeInDbm={" + mPowerRangeInDbm.getLower()
+ + "," + mPowerRangeInDbm.getUpper()
+ + "}}";
+ }
}
}