Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 89e95d5b authored by Jeffrey Huang's avatar Jeffrey Huang Committed by Android (Google) Code Review
Browse files

Merge changes I1510e44b,I9313299e,I7df5c644

* changes:
  Update setBroadcastSubscriber
  Update activeConfigsChangedBroadcast
  Creating PendingIntentRef
parents 72874be4 4f2e6bd6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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",
+46 −0
Original line number Diff line number Diff line
/*
 * 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
+0 −19
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.os;

import android.os.IPullAtomCallback;
import android.os.StatsDimensionsValue;
import android.os.StatsLogEventWrapper;

/**
@@ -66,24 +65,6 @@ interface IStatsCompanionService {
    /** 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.
     */
    oneway void sendActiveConfigsChangedBroadcast(in IBinder intentSender, in long[] configIds);

    /**
     * Requests StatsCompanionService to send a broadcast using the given intentSender
     * (which should cast to an IIntentSender), along with the other information specified.
     */
    oneway void sendSubscriberBroadcast(in IBinder intentSender, long configUid, long configId,
                                        long subscriptionId, long subscriptionRuleId,
                                        in String[] cookies,
                                        in StatsDimensionsValue dimensionsValue);

    /** Tells StatsCompaionService to grab the uid map snapshot and send it to statsd. */
    oneway void triggerUidSnapshot();

+26 −3
Original line number Diff line number Diff line
@@ -30,11 +30,18 @@ interface IStatsManagerService {
     * 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
@@ -45,6 +52,13 @@ interface IStatsManagerService {
     */
    long[] setActiveConfigsChangedOperation(in PendingIntent pendingIntent, in String packageName);

    /**
     * Removes the active configs changed operation for the specified package name.
     *
     * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
     */
    void removeActiveConfigsChangedOperation(in String packageName);

    /**
     * Set the PendingIntent to be used when broadcasting subscriber
     * information to the given subscriberId within the given config.
@@ -58,8 +72,17 @@ interface IStatsManagerService {
     * This function can only be called by the owner (uid) of the config. It must be called each
     * time statsd starts. Later calls overwrite previous calls; only one PendingIntent is stored.
     *
     * Requires Manifest.permission.DUMP.
     * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
     */
    void setBroadcastSubscriber(long configKey, long subscriberId, in PendingIntent pendingIntent,
                                in String packageName);

    /**
     * Undoes setBroadcastSubscriber() for the (configKey, subscriberId) pair.
     * Any broadcasts associated with subscriberId will henceforth not be sent.
     * No-op if this (configKey, subscriberId) pair was not associated with an PendingIntent.
     *
     * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
     */
    void unsetBroadcastSubscriber(long configKey, long subscriberId, in String packageName);
}
 No newline at end of file
+16 −17
Original line number Diff line number Diff line
@@ -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 @@ interface IStatsd {
     *
     * 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
@@ -131,14 +133,14 @@ interface IStatsd {
     *
     * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
     */
    long[] setActiveConfigsChangedOperation(in IBinder intentSender, in String packageName);
    long[] setActiveConfigsChangedOperation(in IPendingIntentRef pendingIntentRef, int callingUid);

    /**
     * Removes the active configs changed operation for the specified package name.
     *
     * Requires Manifest.permission.DUMP and Manifest.permission.PACKAGE_USAGE_STATS.
     */
    void removeActiveConfigsChangedOperation(in String packageName);
    void removeActiveConfigsChangedOperation(int callingUid);

    /**
     * Removes the configuration with the matching config key. No-op if this config key does not
@@ -149,34 +151,31 @@ interface IStatsd {
    void removeConfiguration(in long configKey, in String packageName);

    /**
     * Set the IIntentSender (i.e. PendingIntent) to be used when broadcasting subscriber
     * Set the PendingIntentRef to be used when broadcasting subscriber
     * information to the given subscriberId within the given config.
     *
     * Suppose that the calling uid has added a config with key configKey, and that in this config
     * Suppose that the calling uid has added a config with key configId, and that in this config
     * it is specified that when a particular anomaly is detected, a broadcast should be sent to
     * a BroadcastSubscriber with id subscriberId. This function links the given intentSender with
     * that subscriberId (for that config), so that this intentSender is used to send the broadcast
     * a BroadcastSubscriber with id subscriberId. This function links the given pendingIntent with
     * that subscriberId (for that config), so that this pendingIntent is used to send the broadcast
     * when the anomaly is detected.
     *
     * This function can only be called by the owner (uid) of the config. It must be called each
     * time statsd starts. Later calls overwrite previous calls; only one intentSender is stored.
     *
     * intentSender must be convertible into an IntentSender using IntentSender(IBinder)
     * and cannot be null.
     * time statsd starts. Later calls overwrite previous calls; only one pendingIntent is stored.
     *
     * Requires Manifest.permission.DUMP.
     */
    void setBroadcastSubscriber(long configKey, long subscriberId, in IBinder intentSender,
                                in String packageName);
    void setBroadcastSubscriber(long configId, long subscriberId, in IPendingIntentRef pir,
                                int callingUid);

    /**
     * Undoes setBroadcastSubscriber() for the (configKey, subscriberId) pair.
     * Undoes setBroadcastSubscriber() for the (configId, subscriberId) pair.
     * Any broadcasts associated with subscriberId will henceforth not be sent.
     * No-op if this (configKey, subsriberId) pair was not associated with an IntentSender.
     * No-op if this (configKey, subscriberId) pair was not associated with an PendingIntentRef.
     *
     * Requires Manifest.permission.DUMP.
     */
    void unsetBroadcastSubscriber(long configKey, long subscriberId, in String packageName);
    void unsetBroadcastSubscriber(long configId, long subscriberId, int callingUid);

    /**
     * Apps can send an atom via this application breadcrumb with the specified label and state for
Loading