Merge "ActivityManager: Add dumpsys command to report number of lmkd kills"
diff --git a/api/current.txt b/api/current.txt
index a275bfd..2d6c68c 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -37605,6 +37605,7 @@
field public static final java.lang.String AUTH_TYPE = "authtype";
field public static final deprecated java.lang.String BEARER = "bearer";
field public static final java.lang.String CARRIER_ENABLED = "carrier_enabled";
+ field public static final java.lang.String CARRIER_ID = "carrier_id";
field public static final android.net.Uri CONTENT_URI;
field public static final java.lang.String CURRENT = "current";
field public static final java.lang.String DEFAULT_SORT_ORDER = "name ASC";
diff --git a/api/system-current.txt b/api/system-current.txt
index c08606e..43616cd 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -5496,6 +5496,7 @@
method public int getRadioPowerState();
method public int getSimApplicationState();
method public int getSimCardState();
+ method public int getSupportedRadioAccessFamily();
method public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
method public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
method public android.os.Bundle getVisualVoicemailSettings();
@@ -5561,6 +5562,24 @@
field public static final int NETWORK_MODE_TDSCDMA_WCDMA = 14; // 0xe
field public static final int NETWORK_MODE_WCDMA_ONLY = 2; // 0x2
field public static final int NETWORK_MODE_WCDMA_PREF = 0; // 0x0
+ field public static final int NETWORK_TYPE_BITMASK_1xRTT = 128; // 0x80
+ field public static final int NETWORK_TYPE_BITMASK_CDMA = 16; // 0x10
+ field public static final int NETWORK_TYPE_BITMASK_EDGE = 4; // 0x4
+ field public static final int NETWORK_TYPE_BITMASK_EHRPD = 16384; // 0x4000
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_0 = 32; // 0x20
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_A = 64; // 0x40
+ field public static final int NETWORK_TYPE_BITMASK_EVDO_B = 4096; // 0x1000
+ field public static final int NETWORK_TYPE_BITMASK_GPRS = 2; // 0x2
+ field public static final int NETWORK_TYPE_BITMASK_GSM = 65536; // 0x10000
+ field public static final int NETWORK_TYPE_BITMASK_HSDPA = 256; // 0x100
+ field public static final int NETWORK_TYPE_BITMASK_HSPA = 1024; // 0x400
+ field public static final int NETWORK_TYPE_BITMASK_HSPAP = 32768; // 0x8000
+ field public static final int NETWORK_TYPE_BITMASK_HSUPA = 512; // 0x200
+ field public static final int NETWORK_TYPE_BITMASK_LTE = 8192; // 0x2000
+ field public static final int NETWORK_TYPE_BITMASK_LTE_CA = 524288; // 0x80000
+ field public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = 131072; // 0x20000
+ field public static final int NETWORK_TYPE_BITMASK_UMTS = 8; // 0x8
+ field public static final int NETWORK_TYPE_BITMASK_UNKNOWN = 1; // 0x1
field public static final int RADIO_POWER_OFF = 0; // 0x0
field public static final int RADIO_POWER_ON = 1; // 0x1
field public static final int RADIO_POWER_UNAVAILABLE = 2; // 0x2
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 2f69ac1..bce1820 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -2404,25 +2404,28 @@
* Logs the memory stats for a native process (from procfs).
*/
message NativeProcessMemoryState {
- // The uid if available. -1 means not available.
- optional int32 uid = 1 [(is_uid) = true];
+ // The uid if available. -1 means not available.
+ optional int32 uid = 1 [(is_uid) = true];
- // The process name.
- optional string process_name = 2;
+ // The process name.
+ optional string process_name = 2;
- // # of page-faults
- optional int64 page_fault = 3;
+ // # of page-faults
+ optional int64 page_fault = 3;
- // # of major page-faults
- optional int64 page_major_fault = 4;
+ // # of major page-faults
+ optional int64 page_major_fault = 4;
- // RSS
- optional int64 rss_in_bytes = 5;
+ // RSS
+ optional int64 rss_in_bytes = 5;
- // 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 = 6;
+ // 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;
+
+ // Elapsed real time when the process started.
+ // Value is read from /proc/PID/stat, field 22.
+ optional int64 start_time_nanos = 7;
}
/*
@@ -3117,4 +3120,4 @@
optional int64 user_time_millis = 3;
// Process cpu time in system space, cumulative from boot/process start
optional int64 system_time_millis = 4;
-}
\ No newline at end of file
+}
diff --git a/cmds/statsd/src/external/StatsPullerManager.cpp b/cmds/statsd/src/external/StatsPullerManager.cpp
index ba626f8..73a88c1 100644
--- a/cmds/statsd/src/external/StatsPullerManager.cpp
+++ b/cmds/statsd/src/external/StatsPullerManager.cpp
@@ -172,7 +172,7 @@
new StatsCompanionServicePuller(android::util::PROCESS_MEMORY_STATE)}},
// native_process_memory_state
{android::util::NATIVE_PROCESS_MEMORY_STATE,
- {{3, 4, 5, 6},
+ {{3, 4, 5, 6, 7},
{2},
1 * NS_PER_SEC,
new StatsCompanionServicePuller(android::util::NATIVE_PROCESS_MEMORY_STATE)}},
diff --git a/core/java/android/app/ProcessMemoryState.java b/core/java/android/app/ProcessMemoryState.java
index 9bfdae0..d149243 100644
--- a/core/java/android/app/ProcessMemoryState.java
+++ b/core/java/android/app/ProcessMemoryState.java
@@ -33,10 +33,11 @@
public final long cacheInBytes;
public final long swapInBytes;
public final long rssHighWatermarkInBytes;
+ public final long startTimeNanos;
public ProcessMemoryState(int uid, String processName, int oomScore, long pgfault,
long pgmajfault, long rssInBytes, long cacheInBytes,
- long swapInBytes, long rssHighWatermarkInBytes) {
+ long swapInBytes, long rssHighWatermarkInBytes, long startTimeNanos) {
this.uid = uid;
this.processName = processName;
this.oomScore = oomScore;
@@ -46,6 +47,7 @@
this.cacheInBytes = cacheInBytes;
this.swapInBytes = swapInBytes;
this.rssHighWatermarkInBytes = rssHighWatermarkInBytes;
+ this.startTimeNanos = startTimeNanos;
}
private ProcessMemoryState(Parcel in) {
@@ -58,6 +60,7 @@
cacheInBytes = in.readLong();
swapInBytes = in.readLong();
rssHighWatermarkInBytes = in.readLong();
+ startTimeNanos = in.readLong();
}
public static final Creator<ProcessMemoryState> CREATOR = new Creator<ProcessMemoryState>() {
@@ -88,5 +91,6 @@
parcel.writeLong(cacheInBytes);
parcel.writeLong(swapInBytes);
parcel.writeLong(rssHighWatermarkInBytes);
+ parcel.writeLong(startTimeNanos);
}
}
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index ea1a2fe..5ab643c 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -5285,6 +5285,7 @@
FLAG_RECEIVER_EXCLUDE_BACKGROUND,
FLAG_RECEIVER_FROM_SHELL,
FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS,
+ FLAG_RECEIVER_OFFLOAD,
})
@Retention(RetentionPolicy.SOURCE)
public @interface Flags {}
@@ -5329,6 +5330,7 @@
FLAG_RECEIVER_EXCLUDE_BACKGROUND,
FLAG_RECEIVER_FROM_SHELL,
FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS,
+ FLAG_RECEIVER_OFFLOAD,
})
@Retention(RetentionPolicy.SOURCE)
public @interface MutableFlags {}
@@ -5755,6 +5757,12 @@
*/
public static final int FLAG_RECEIVER_FOREGROUND = 0x10000000;
/**
+ * If set, when sending a broadcast the recipient will be run on the offload queue.
+ *
+ * @hide
+ */
+ public static final int FLAG_RECEIVER_OFFLOAD = 0x80000000;
+ /**
* If this is an ordered broadcast, don't allow receivers to abort the broadcast.
* They can still propagate results through to later receivers, but they can not prevent
* later receivers from seeing the broadcast.
diff --git a/libs/hwui/renderthread/VulkanManager.cpp b/libs/hwui/renderthread/VulkanManager.cpp
index 9e435a5..f96b1f8 100644
--- a/libs/hwui/renderthread/VulkanManager.cpp
+++ b/libs/hwui/renderthread/VulkanManager.cpp
@@ -16,8 +16,6 @@
#include "VulkanManager.h"
-#include <private/gui/SyncFeatures.h>
-
#include "Properties.h"
#include "RenderThread.h"
#include "renderstate/RenderState.h"
@@ -1033,69 +1031,59 @@
return INVALID_OPERATION;
}
- if (SyncFeatures::getInstance().useWaitSync() &&
- SyncFeatures::getInstance().useNativeFenceSync()) {
- // Block GPU on the fence.
- int fenceFd = fence->dup();
- if (fenceFd == -1) {
- ALOGE("VulkanManager::fenceWait: error dup'ing fence fd: %d", errno);
- return -errno;
- }
-
- VkSemaphoreCreateInfo semaphoreInfo;
- semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
- semaphoreInfo.pNext = nullptr;
- semaphoreInfo.flags = 0;
- VkSemaphore semaphore;
- VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
- if (VK_SUCCESS != err) {
- ALOGE("Failed to create import semaphore, err: %d", err);
- return UNKNOWN_ERROR;
- }
- VkImportSemaphoreFdInfoKHR importInfo;
- importInfo.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
- importInfo.pNext = nullptr;
- importInfo.semaphore = semaphore;
- importInfo.flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT;
- importInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
- importInfo.fd = fenceFd;
-
- err = mImportSemaphoreFdKHR(mDevice, &importInfo);
- if (VK_SUCCESS != err) {
- ALOGE("Failed to import semaphore, err: %d", err);
- return UNKNOWN_ERROR;
- }
-
- LOG_ALWAYS_FATAL_IF(mDummyCB == VK_NULL_HANDLE);
-
- VkPipelineStageFlags waitDstStageFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
-
- VkSubmitInfo submitInfo;
- memset(&submitInfo, 0, sizeof(VkSubmitInfo));
- submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
- submitInfo.waitSemaphoreCount = 1;
- // Wait to make sure aquire semaphore set above has signaled.
- submitInfo.pWaitSemaphores = &semaphore;
- submitInfo.pWaitDstStageMask = &waitDstStageFlags;
- submitInfo.commandBufferCount = 1;
- submitInfo.pCommandBuffers = &mDummyCB;
- submitInfo.signalSemaphoreCount = 0;
-
- mQueueSubmit(mGraphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
-
- // On Android when we import a semaphore, it is imported using temporary permanence. That
- // means as soon as we queue the semaphore for a wait it reverts to its previous permanent
- // state before importing. This means it will now be in an idle state with no pending
- // signal or wait operations, so it is safe to immediately delete it.
- mDestroySemaphore(mDevice, semaphore, nullptr);
- } else {
- // Block CPU on the fence.
- status_t err = fence->waitForever("VulkanManager::fenceWait");
- if (err != NO_ERROR) {
- ALOGE("VulkanManager::fenceWait: error waiting for fence: %d", err);
- return err;
- }
+ // Block GPU on the fence.
+ int fenceFd = fence->dup();
+ if (fenceFd == -1) {
+ ALOGE("VulkanManager::fenceWait: error dup'ing fence fd: %d", errno);
+ return -errno;
}
+
+ VkSemaphoreCreateInfo semaphoreInfo;
+ semaphoreInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
+ semaphoreInfo.pNext = nullptr;
+ semaphoreInfo.flags = 0;
+ VkSemaphore semaphore;
+ VkResult err = mCreateSemaphore(mDevice, &semaphoreInfo, nullptr, &semaphore);
+ if (VK_SUCCESS != err) {
+ ALOGE("Failed to create import semaphore, err: %d", err);
+ return UNKNOWN_ERROR;
+ }
+ VkImportSemaphoreFdInfoKHR importInfo;
+ importInfo.sType = VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR;
+ importInfo.pNext = nullptr;
+ importInfo.semaphore = semaphore;
+ importInfo.flags = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT;
+ importInfo.handleType = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
+ importInfo.fd = fenceFd;
+
+ err = mImportSemaphoreFdKHR(mDevice, &importInfo);
+ if (VK_SUCCESS != err) {
+ ALOGE("Failed to import semaphore, err: %d", err);
+ return UNKNOWN_ERROR;
+ }
+
+ LOG_ALWAYS_FATAL_IF(mDummyCB == VK_NULL_HANDLE);
+
+ VkPipelineStageFlags waitDstStageFlags = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT;
+
+ VkSubmitInfo submitInfo;
+ memset(&submitInfo, 0, sizeof(VkSubmitInfo));
+ submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
+ submitInfo.waitSemaphoreCount = 1;
+ // Wait to make sure aquire semaphore set above has signaled.
+ submitInfo.pWaitSemaphores = &semaphore;
+ submitInfo.pWaitDstStageMask = &waitDstStageFlags;
+ submitInfo.commandBufferCount = 1;
+ submitInfo.pCommandBuffers = &mDummyCB;
+ submitInfo.signalSemaphoreCount = 0;
+
+ mQueueSubmit(mGraphicsQueue, 1, &submitInfo, VK_NULL_HANDLE);
+
+ // On Android when we import a semaphore, it is imported using temporary permanence. That
+ // means as soon as we queue the semaphore for a wait it reverts to its previous permanent
+ // state before importing. This means it will now be in an idle state with no pending
+ // signal or wait operations, so it is safe to immediately delete it.
+ mDestroySemaphore(mDevice, semaphore, nullptr);
return OK;
}
@@ -1105,15 +1093,6 @@
return INVALID_OPERATION;
}
- if (SyncFeatures::getInstance().useFenceSync()) {
- ALOGE("VulkanManager::createReleaseFence: Vk backend doesn't support non-native fences");
- return INVALID_OPERATION;
- }
-
- if (!SyncFeatures::getInstance().useNativeFenceSync()) {
- return OK;
- }
-
VkExportSemaphoreCreateInfo exportInfo;
exportInfo.sType = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO;
exportInfo.pNext = nullptr;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 6aa049d..e8c6365 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -538,14 +538,23 @@
BroadcastQueue mFgBroadcastQueue;
BroadcastQueue mBgBroadcastQueue;
+ BroadcastQueue mOffloadBroadcastQueue;
// Convenient for easy iteration over the queues. Foreground is first
// so that dispatch of foreground broadcasts gets precedence.
- final BroadcastQueue[] mBroadcastQueues = new BroadcastQueue[2];
+ final BroadcastQueue[] mBroadcastQueues = new BroadcastQueue[3];
BroadcastStats mLastBroadcastStats;
BroadcastStats mCurBroadcastStats;
BroadcastQueue broadcastQueueForIntent(Intent intent) {
+ if (isOnOffloadQueue(intent.getFlags())) {
+ if (DEBUG_BROADCAST_BACKGROUND) {
+ Slog.i(TAG_BROADCAST,
+ "Broadcast intent " + intent + " on offload queue");
+ }
+ return mOffloadBroadcastQueue;
+ }
+
final boolean isFg = (intent.getFlags() & Intent.FLAG_RECEIVER_FOREGROUND) != 0;
if (DEBUG_BROADCAST_BACKGROUND) Slog.i(TAG_BROADCAST,
"Broadcast intent " + intent + " on "
@@ -2166,8 +2175,11 @@
"foreground", BROADCAST_FG_TIMEOUT, false);
mBgBroadcastQueue = new BroadcastQueue(this, mHandler,
"background", BROADCAST_BG_TIMEOUT, true);
+ mOffloadBroadcastQueue = new BroadcastQueue(this, mHandler,
+ "offload", BROADCAST_BG_TIMEOUT, true);
mBroadcastQueues[0] = mFgBroadcastQueue;
mBroadcastQueues[1] = mBgBroadcastQueue;
+ mBroadcastQueues[2] = mOffloadBroadcastQueue;
mServices = new ActiveServices(this);
mProviderMap = new ProviderMap(this);
@@ -13385,7 +13397,8 @@
boolean isPendingBroadcastProcessLocked(int pid) {
return mFgBroadcastQueue.isPendingBroadcastProcessLocked(pid)
- || mBgBroadcastQueue.isPendingBroadcastProcessLocked(pid);
+ || mBgBroadcastQueue.isPendingBroadcastProcessLocked(pid)
+ || mOffloadBroadcastQueue.isPendingBroadcastProcessLocked(pid);
}
void skipPendingBroadcastLocked(int pid) {
@@ -14627,10 +14640,16 @@
try {
boolean doNext = false;
BroadcastRecord r;
+ BroadcastQueue queue;
synchronized(this) {
- BroadcastQueue queue = (flags & Intent.FLAG_RECEIVER_FOREGROUND) != 0
- ? mFgBroadcastQueue : mBgBroadcastQueue;
+ if (isOnOffloadQueue(flags)) {
+ queue = mOffloadBroadcastQueue;
+ } else {
+ queue = (flags & Intent.FLAG_RECEIVER_FOREGROUND) != 0
+ ? mFgBroadcastQueue : mBgBroadcastQueue;
+ }
+
r = queue.getMatchingOrderedReceiver(who);
if (r != null) {
doNext = r.queue.finishReceiverLocked(r, resultCode,
@@ -18660,7 +18679,8 @@
memoryStat.rssInBytes,
memoryStat.cacheInBytes,
memoryStat.swapInBytes,
- memoryStat.rssHighWatermarkInBytes);
+ memoryStat.rssHighWatermarkInBytes,
+ memoryStat.startTimeNanos);
processMemoryStates.add(processMemoryState);
}
}
@@ -18683,7 +18703,7 @@
ProcessMemoryState processMemoryState = new ProcessMemoryState(uid, processName,
oomScore, memoryStat.pgfault, memoryStat.pgmajfault,
memoryStat.rssInBytes, memoryStat.cacheInBytes, memoryStat.swapInBytes,
- memoryStat.rssHighWatermarkInBytes);
+ memoryStat.rssHighWatermarkInBytes, memoryStat.startTimeNanos);
processMemoryStates.add(processMemoryState);
}
return processMemoryStates;
@@ -19524,4 +19544,8 @@
}
}
}
+
+ private boolean isOnOffloadQueue(int flags) {
+ return ((flags & Intent.FLAG_RECEIVER_OFFLOAD) != 0);
+ }
}
diff --git a/services/core/java/com/android/server/am/MemoryStatUtil.java b/services/core/java/com/android/server/am/MemoryStatUtil.java
index 2c4b338..f77be5b 100644
--- a/services/core/java/com/android/server/am/MemoryStatUtil.java
+++ b/services/core/java/com/android/server/am/MemoryStatUtil.java
@@ -23,6 +23,8 @@
import android.annotation.Nullable;
import android.os.FileUtils;
import android.os.SystemProperties;
+import android.system.Os;
+import android.system.OsConstants;
import android.util.Slog;
import com.android.internal.annotations.VisibleForTesting;
@@ -71,6 +73,7 @@
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);
private static final String TAG = TAG_WITH_CLASS_NAME ? "MemoryStatUtil" : TAG_AM;
@@ -103,6 +106,7 @@
private static final int PGFAULT_INDEX = 9;
private static final int PGMAJFAULT_INDEX = 11;
+ private static final int START_TIME_INDEX = 21;
private static final int RSS_IN_PAGES_INDEX = 23;
private MemoryStatUtil() {}
@@ -238,6 +242,7 @@
memoryStat.pgfault = Long.parseLong(splits[PGFAULT_INDEX]);
memoryStat.pgmajfault = Long.parseLong(splits[PGMAJFAULT_INDEX]);
memoryStat.rssInBytes = Long.parseLong(splits[RSS_IN_PAGES_INDEX]) * PAGE_SIZE;
+ memoryStat.startTimeNanos = Long.parseLong(splits[START_TIME_INDEX]) * JIFFY_NANOS;
return memoryStat;
} catch (NumberFormatException e) {
Slog.e(TAG, "Failed to parse value", e);
@@ -279,5 +284,7 @@
long swapInBytes;
/** Number of bytes of peak anonymous and swap cache memory */
long rssHighWatermarkInBytes;
+ /** Device time when the processes started. */
+ long startTimeNanos;
}
}
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index 81f853d..353f787 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -22,14 +22,15 @@
import static android.app.ActivityManager.USER_OP_ERROR_RELATED_USERS_CANNOT_STOP;
import static android.app.ActivityManager.USER_OP_IS_CURRENT;
import static android.app.ActivityManager.USER_OP_SUCCESS;
-import static android.os.Process.SHELL_UID;
-import static android.os.Process.SYSTEM_UID;
-import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
-import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static android.app.ActivityManagerInternal.ALLOW_FULL_ONLY;
import static android.app.ActivityManagerInternal.ALLOW_NON_FULL;
import static android.app.ActivityManagerInternal.ALLOW_NON_FULL_IN_PROFILE;
+import static android.os.Process.SHELL_UID;
+import static android.os.Process.SYSTEM_UID;
+
+import static com.android.server.am.ActivityManagerDebugConfig.DEBUG_MU;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM;
+import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.am.ActivityManagerService.MY_PID;
import static com.android.server.am.UserState.STATE_BOOTING;
import static com.android.server.am.UserState.STATE_RUNNING_LOCKED;
@@ -40,7 +41,6 @@
import android.annotation.Nullable;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
-import com.android.server.wm.ActivityTaskManagerInternal;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.Dialog;
@@ -99,6 +99,7 @@
import com.android.server.LocalServices;
import com.android.server.SystemServiceManager;
import com.android.server.pm.UserManagerService;
+import com.android.server.wm.ActivityTaskManagerInternal;
import com.android.server.wm.WindowManagerService;
import java.io.PrintWriter;
@@ -549,7 +550,8 @@
final Intent bootIntent = new Intent(Intent.ACTION_BOOT_COMPLETED, null);
bootIntent.putExtra(Intent.EXTRA_USER_HANDLE, userId);
bootIntent.addFlags(Intent.FLAG_RECEIVER_NO_ABORT
- | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND);
+ | Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND
+ | Intent.FLAG_RECEIVER_OFFLOAD);
mInjector.broadcastIntent(bootIntent, null, new IIntentReceiver.Stub() {
@Override
public void performReceive(Intent intent, int resultCode, String data,
diff --git a/services/core/java/com/android/server/stats/StatsCompanionService.java b/services/core/java/com/android/server/stats/StatsCompanionService.java
index 5600749..1948706 100644
--- a/services/core/java/com/android/server/stats/StatsCompanionService.java
+++ b/services/core/java/com/android/server/stats/StatsCompanionService.java
@@ -1017,6 +1017,7 @@
e.writeLong(processMemoryState.pgmajfault);
e.writeLong(processMemoryState.rssInBytes);
e.writeLong(processMemoryState.rssHighWatermarkInBytes);
+ e.writeLong(processMemoryState.startTimeNanos);
pulledData.add(e);
}
}
diff --git a/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java b/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java
index 9a283fe..72c5b10 100644
--- a/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/MemoryStatUtilTest.java
@@ -17,6 +17,7 @@
package com.android.server.am;
import static com.android.server.am.MemoryStatUtil.BYTES_IN_KILOBYTE;
+import static com.android.server.am.MemoryStatUtil.JIFFY_NANOS;
import static com.android.server.am.MemoryStatUtil.MemoryStat;
import static com.android.server.am.MemoryStatUtil.PAGE_SIZE;
import static com.android.server.am.MemoryStatUtil.parseMemoryMaxUsageFromMemCg;
@@ -96,7 +97,7 @@
"-2",
"117",
"0",
- "2206",
+ "2222", // this in start time (in ticks per second)
"1257177088",
"3", // this is RSS (number of pages)
"4294967295",
@@ -219,6 +220,7 @@
assertEquals(3 * PAGE_SIZE, stat.rssInBytes);
assertEquals(0, stat.cacheInBytes);
assertEquals(0, stat.swapInBytes);
+ assertEquals(2222 * JIFFY_NANOS, stat.startTimeNanos);
}
@Test
diff --git a/telephony/java/android/provider/Telephony.java b/telephony/java/android/provider/Telephony.java
index 6c9c01c..52ac32d 100644
--- a/telephony/java/android/provider/Telephony.java
+++ b/telephony/java/android/provider/Telephony.java
@@ -3086,6 +3086,13 @@
@SystemApi
public static final int NO_SET_SET = 0;
+ /**
+ * A unique carrier id associated with this APN
+ * {@see TelephonyManager#getSimCarrierId()}
+ * <p>Type: STRING</p>
+ */
+ public static final String CARRIER_ID = "carrier_id";
+
}
/**
diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java
index 1d79988..da3acc2 100644
--- a/telephony/java/android/telephony/RadioAccessFamily.java
+++ b/telephony/java/android/telephony/RadioAccessFamily.java
@@ -29,29 +29,32 @@
*/
public class RadioAccessFamily implements Parcelable {
- // Radio Access Family
+ /**
+ * TODO: get rid of RAF definition in RadioAccessFamily and
+ * use {@link TelephonyManager.NetworkTypeBitMask}
+ */
// 2G
- public static final int RAF_UNKNOWN = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UNKNOWN);
- public static final int RAF_GSM = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM);
- public static final int RAF_GPRS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS);
- public static final int RAF_EDGE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE);
- public static final int RAF_IS95A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A);
- public static final int RAF_IS95B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B);
- public static final int RAF_1xRTT = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT);
+ public static final int RAF_UNKNOWN = TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
+ public static final int RAF_GSM = TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
+ public static final int RAF_GPRS = TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
+ public static final int RAF_EDGE = TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
+ public static final int RAF_IS95A = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ public static final int RAF_IS95B = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ public static final int RAF_1xRTT = TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
// 3G
- public static final int RAF_EVDO_0 = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0);
- public static final int RAF_EVDO_A = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A);
- public static final int RAF_EVDO_B = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B);
- public static final int RAF_EHRPD = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD);
- public static final int RAF_HSUPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA);
- public static final int RAF_HSDPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA);
- public static final int RAF_HSPA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA);
- public static final int RAF_HSPAP = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP);
- public static final int RAF_UMTS = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS);
- public static final int RAF_TD_SCDMA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA);
+ public static final int RAF_EVDO_0 = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
+ public static final int RAF_EVDO_A = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
+ public static final int RAF_EVDO_B = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
+ public static final int RAF_EHRPD = TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
+ public static final int RAF_HSUPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
+ public static final int RAF_HSDPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
+ public static final int RAF_HSPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
+ public static final int RAF_HSPAP = TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
+ public static final int RAF_UMTS = TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
+ public static final int RAF_TD_SCDMA = TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
// 4G
- public static final int RAF_LTE = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE);
- public static final int RAF_LTE_CA = (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA);
+ public static final int RAF_LTE = TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ public static final int RAF_LTE_CA = TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
// Grouping of RAFs
// 2G
@@ -74,9 +77,9 @@
* Constructor.
*
* @param phoneId the phone ID
- * @param radioAccessFamily the phone radio access family defined
- * in RadioAccessFamily. It's a bit mask value to represent
- * the support type.
+ * @param radioAccessFamily the phone radio access family bitmask based on
+ * {@link TelephonyManager.NetworkTypeBitMask}. It's a bit mask value to represent the support
+ * type.
*/
@UnsupportedAppUsage
public RadioAccessFamily(int phoneId, int radioAccessFamily) {
@@ -100,7 +103,7 @@
* @return radio access family
*/
@UnsupportedAppUsage
- public int getRadioAccessFamily() {
+ public @TelephonyManager.NetworkTypeBitMask int getRadioAccessFamily() {
return mRadioAccessFamily;
}
@@ -388,4 +391,76 @@
}
return result;
}
+
+ /**
+ * convert RAF from {@link ServiceState.RilRadioTechnology} bitmask to
+ * {@link TelephonyManager.NetworkTypeBitMask}, the bitmask represented by
+ * {@link TelephonyManager.NetworkType}. Reasons are {@link TelephonyManager.NetworkType} are
+ * public while {@link ServiceState.RilRadioTechnology} are hidden. We
+ * don't want to expose two sets of definition to public.
+ *
+ * @param raf bitmask represented by {@link ServiceState.RilRadioTechnology}
+ * @return {@link TelephonyManager.NetworkTypeBitMask}
+ */
+ public static int convertToNetworkTypeBitMask(int raf) {
+ int networkTypeRaf = 0;
+
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
+ }
+ // convert both IS95A/IS95B to CDMA as network mode doesn't support CDMA
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
+ }
+ if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA)) != 0) {
+ networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
+ }
+
+ return (networkTypeRaf == 0) ? TelephonyManager.NETWORK_TYPE_UNKNOWN : networkTypeRaf;
+ }
}
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index e913101..f484d1f 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -8820,4 +8820,168 @@
return isEnabled;
}
+
+ /** @hide */
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef(flag = true, prefix = {"NETWORK_TYPE_BITMASK_"},
+ value = {NETWORK_TYPE_BITMASK_UNKNOWN,
+ NETWORK_TYPE_BITMASK_GSM,
+ NETWORK_TYPE_BITMASK_GPRS,
+ NETWORK_TYPE_BITMASK_EDGE,
+ NETWORK_TYPE_BITMASK_CDMA,
+ NETWORK_TYPE_BITMASK_1xRTT,
+ NETWORK_TYPE_BITMASK_EVDO_0,
+ NETWORK_TYPE_BITMASK_EVDO_A,
+ NETWORK_TYPE_BITMASK_EVDO_B,
+ NETWORK_TYPE_BITMASK_EHRPD,
+ NETWORK_TYPE_BITMASK_HSUPA,
+ NETWORK_TYPE_BITMASK_HSDPA,
+ NETWORK_TYPE_BITMASK_HSPA,
+ NETWORK_TYPE_BITMASK_HSPAP,
+ NETWORK_TYPE_BITMASK_UMTS,
+ NETWORK_TYPE_BITMASK_TD_SCDMA,
+ NETWORK_TYPE_BITMASK_LTE,
+ NETWORK_TYPE_BITMASK_LTE_CA,
+ })
+ public @interface NetworkTypeBitMask {}
+
+ // 2G
+ /**
+ * network type bitmask unknown.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_UNKNOWN = (1 << NETWORK_TYPE_UNKNOWN);
+ /**
+ * network type bitmask indicating the support of radio tech GSM.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_GSM = (1 << NETWORK_TYPE_GSM);
+ /**
+ * network type bitmask indicating the support of radio tech GPRS.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_GPRS = (1 << NETWORK_TYPE_GPRS);
+ /**
+ * network type bitmask indicating the support of radio tech EDGE.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EDGE = (1 << NETWORK_TYPE_EDGE);
+ /**
+ * network type bitmask indicating the support of radio tech CDMA(IS95A/IS95B).
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_CDMA = (1 << NETWORK_TYPE_CDMA);
+ /**
+ * network type bitmask indicating the support of radio tech 1xRTT.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_1xRTT = (1 << NETWORK_TYPE_1xRTT);
+ // 3G
+ /**
+ * network type bitmask indicating the support of radio tech EVDO 0.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_0 = (1 << NETWORK_TYPE_EVDO_0);
+ /**
+ * network type bitmask indicating the support of radio tech EVDO A.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_A = (1 << NETWORK_TYPE_EVDO_A);
+ /**
+ * network type bitmask indicating the support of radio tech EVDO B.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EVDO_B = (1 << NETWORK_TYPE_EVDO_B);
+ /**
+ * network type bitmask indicating the support of radio tech EHRPD.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_EHRPD = (1 << NETWORK_TYPE_EHRPD);
+ /**
+ * network type bitmask indicating the support of radio tech HSUPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSUPA = (1 << NETWORK_TYPE_HSUPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSDPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSDPA = (1 << NETWORK_TYPE_HSDPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSPA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSPA = (1 << NETWORK_TYPE_HSPA);
+ /**
+ * network type bitmask indicating the support of radio tech HSPAP.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_HSPAP = (1 << NETWORK_TYPE_HSPAP);
+ /**
+ * network type bitmask indicating the support of radio tech UMTS.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_UMTS = (1 << NETWORK_TYPE_UMTS);
+ /**
+ * network type bitmask indicating the support of radio tech TD_SCDMA.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = (1 << NETWORK_TYPE_TD_SCDMA);
+ // 4G
+ /**
+ * network type bitmask indicating the support of radio tech LTE.
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_LTE = (1 << NETWORK_TYPE_LTE);
+ /**
+ * network type bitmask indicating the support of radio tech LTE CA (carrier aggregation).
+ * @hide
+ */
+ @SystemApi
+ public static final int NETWORK_TYPE_BITMASK_LTE_CA = (1 << NETWORK_TYPE_LTE_CA);
+
+ /**
+ * @return Modem supported radio access family bitmask {@link NetworkTypeBitMask}
+ *
+ * <p>Requires permission: {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or
+ * that the calling app has carrier privileges (see {@link #hasCarrierPrivileges}).
+ * @hide
+ */
+ @SystemApi
+ @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ public @NetworkTypeBitMask int getSupportedRadioAccessFamily() {
+ try {
+ ITelephony telephony = getITelephony();
+ if (telephony != null) {
+ return telephony.getRadioAccessFamily(getSlotIndex(), getOpPackageName());
+ } else {
+ // This can happen when the ITelephony interface is not up yet.
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ }
+ } catch (RemoteException ex) {
+ // This shouldn't happen in the normal case
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ } catch (NullPointerException ex) {
+ // This could happen before phone restarts due to crashing
+ return NETWORK_TYPE_BITMASK_UNKNOWN;
+ }
+ }
+
}
diff --git a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
index eda8e77..eb6be65 100644
--- a/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
+++ b/telephony/java/com/android/internal/telephony/TelephonyPermissions.java
@@ -456,6 +456,27 @@
}
/**
+ * Ensure the caller (or self, if not processing an IPC) has
+ * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE} or carrier privileges.
+ *
+ * @throws SecurityException if the caller does not have the required permission/privileges
+ */
+ public static void enforeceCallingOrSelfReadPrivilegedPhoneStatePermissionOrCarrierPrivilege(
+ Context context, int subId, String message) {
+ if (context.checkCallingOrSelfPermission(Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
+ == PERMISSION_GRANTED) {
+ return;
+ }
+
+ if (DBG) {
+ Rlog.d(LOG_TAG, "No READ_PRIVILEDED_PHONE_STATE permission, " +
+ "check carrier privilege next.");
+ }
+
+ enforceCallingOrSelfCarrierPrivilege(subId, message);
+ }
+
+ /**
* Make sure the caller (or self, if not processing an IPC) has carrier privileges.
*
* @throws SecurityException if the caller does not have the required privileges