Creating PendingIntentRef
Update #setDataFetchOperation to avoid using intentsender.
Bug: 146074295
Test: Ran GTS Tests
Change-Id: I7df5c6441725aa4e46fac18925664c9455f50fb9
diff --git a/apex/statsd/aidl/Android.bp b/apex/statsd/aidl/Android.bp
index aed6ad9..f8325d4 100644
--- a/apex/statsd/aidl/Android.bp
+++ b/apex/statsd/aidl/Android.bp
@@ -18,6 +18,7 @@
filegroup {
name: "statsd_aidl",
srcs: [
+ "android/os/IPendingIntentRef.aidl",
"android/os/IPullAtomCallback.aidl",
"android/os/IPullAtomResultReceiver.aidl",
"android/os/IStatsCompanionService.aidl",
diff --git a/apex/statsd/aidl/android/os/IPendingIntentRef.aidl b/apex/statsd/aidl/android/os/IPendingIntentRef.aidl
new file mode 100644
index 0000000..6b9e467
--- /dev/null
+++ b/apex/statsd/aidl/android/os/IPendingIntentRef.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2019 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.os;
+
+import android.os.StatsDimensionsValue;
+
+/**
+ * Binder interface to hold a PendingIntent for StatsCompanionService.
+ * {@hide}
+ */
+interface IPendingIntentRef {
+
+ /**
+ * Sends a broadcast to the specified PendingIntent that it should getData now.
+ * This should be only called from StatsCompanionService.
+ */
+ oneway void sendDataBroadcast(long lastReportTimeNs);
+
+ /**
+ * Send a broadcast to the specified PendingIntent notifying it that the list of active configs
+ * has changed. This should be only called from StatsCompanionService.
+ */
+ oneway void sendActiveConfigsChangedBroadcast(in long[] configIds);
+
+ /**
+ * Send a broadcast to the specified PendingIntent, along with the other information
+ * specified. This should only be called from StatsCompanionService.
+ */
+ oneway void sendSubscriberBroadcast(long configUid, long configId, long subscriptionId,
+ long subscriptionRuleId, in String[] cookies,
+ in StatsDimensionsValue dimensionsValue);
+}
\ No newline at end of file
diff --git a/apex/statsd/aidl/android/os/IStatsCompanionService.aidl b/apex/statsd/aidl/android/os/IStatsCompanionService.aidl
index 5a6118e..ec3a226 100644
--- a/apex/statsd/aidl/android/os/IStatsCompanionService.aidl
+++ b/apex/statsd/aidl/android/os/IStatsCompanionService.aidl
@@ -66,9 +66,6 @@
/** Pull the specified data. Results will be sent to statsd when complete. */
StatsLogEventWrapper[] pullData(int pullCode);
- /** Send a broadcast to the specified PendingIntent's as IBinder that it should getData now. */
- oneway void sendDataBroadcast(in IBinder intentSender, long lastReportTimeNs);
-
/**
* Send a broadcast to the specified PendingIntent's as IBinder notifying it that the list
* of active configs has changed.
diff --git a/apex/statsd/aidl/android/os/IStatsManagerService.aidl b/apex/statsd/aidl/android/os/IStatsManagerService.aidl
index 45ba3a2..151cdbd 100644
--- a/apex/statsd/aidl/android/os/IStatsManagerService.aidl
+++ b/apex/statsd/aidl/android/os/IStatsManagerService.aidl
@@ -30,12 +30,19 @@
* memory consumed by the metrics for this configuration approach the pre-defined limits. There
* can be at most one listener per config key.
*
- * Requires Manifest.permission.DUMP.
+ * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
*/
- void setDataFetchOperation(long configKey, in PendingIntent pendingIntent,
+ void setDataFetchOperation(long configId, in PendingIntent pendingIntent,
in String packageName);
/**
+ * Removes the data fetch operation for the specified configuration.
+ *
+ * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
+ */
+ void removeDataFetchOperation(long configId, in String packageName);
+
+ /**
* Registers the given pending intent for this packagename. This intent is invoked when the
* active status of any of the configs sent by this package changes and will contain a list of
* config ids that are currently active. It also returns the list of configs that are currently
diff --git a/apex/statsd/aidl/android/os/IStatsd.aidl b/apex/statsd/aidl/android/os/IStatsd.aidl
index cce79fa..986d483 100644
--- a/apex/statsd/aidl/android/os/IStatsd.aidl
+++ b/apex/statsd/aidl/android/os/IStatsd.aidl
@@ -17,6 +17,7 @@
package android.os;
import android.os.IStatsPullerCallback;
+import android.os.IPendingIntentRef;
import android.os.IPullAtomCallback;
import android.os.ParcelFileDescriptor;
@@ -114,14 +115,15 @@
*
* Requires Manifest.permission.DUMP.
*/
- void setDataFetchOperation(long configKey, in IBinder intentSender, in String packageName);
+ void setDataFetchOperation(long configId, in IPendingIntentRef pendingIntentRef,
+ int callingUid);
/**
* Removes the data fetch operation for the specified configuration.
*
* Requires Manifest.permission.DUMP.
*/
- void removeDataFetchOperation(long configKey, in String packageName);
+ void removeDataFetchOperation(long configId, int callingUid);
/**
* Registers the given pending intent for this packagename. This intent is invoked when the