summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorIrina Dumitrescu <irinaid@google.com>2018-06-08 14:51:12 +0100
committerIrina Dumitrescu <irinaid@google.com>2018-06-20 16:23:58 +0100
commit24ed35cd83b0a71fab33c140e9c5cc64cc5031db (patch)
tree8eb08edb4a642629d485dace5b590ac28cb8d51a /core/java/android
parentfd3618a971cfd690dbeddfb502fce076566ff498 (diff)
Add dpm force-network-logs command to force network logs retrieval.
This is useful because logs are batched every 1.5-2hrs if there are not enough logs to fill up a batch. The command is throttled at 10 seconds as a spam prevention measure. Bug: 62251154 Test: in adb shell run dpm force-network-logs. Observe a new batch being created in the phone directory /storage/emulated/0/Android/data/com.afwsamples.testdpc/files/. Also observe a fresh batch is being displayed on the phone in the TestDPC app, under "Retrieve network logs". Change-Id: I5ff9d5c78497ea81533b5248816b4d6e160d338f
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java16
-rw-r--r--core/java/android/app/admin/IDevicePolicyManager.aidl1
2 files changed, 17 insertions, 0 deletions
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index ff38c1f37007..7ba444729bfc 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -8300,6 +8300,22 @@ public class DevicePolicyManager {
}
/**
+ * Makes all accumulated network logs available to DPC in a new batch.
+ * Only callable by ADB. If throttled, returns time to wait in milliseconds, otherwise 0.
+ * @hide
+ */
+ public long forceNetworkLogs() {
+ if (mService == null) {
+ return -1;
+ }
+ try {
+ return mService.forceNetworkLogs();
+ } catch (RemoteException re) {
+ throw re.rethrowFromSystemServer();
+ }
+ }
+
+ /**
* Forces a batch of security logs to be fetched from logd and makes it available for DPC.
* Only callable by ADB. If throttled, returns time to wait in milliseconds, otherwise 0.
* @hide
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 37508cdc1119..e3b160fd6fe1 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -347,6 +347,7 @@ interface IDevicePolicyManager {
boolean isSecurityLoggingEnabled(in ComponentName admin);
ParceledListSlice retrieveSecurityLogs(in ComponentName admin);
ParceledListSlice retrievePreRebootSecurityLogs(in ComponentName admin);
+ long forceNetworkLogs();
long forceSecurityLogs();
boolean isUninstallInQueue(String packageName);