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

Commit 41ffe985 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Allow pullAtomCallbacks to be unregistered in Java"

parents 98ecb535 fa1c137d
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -26,6 +26,6 @@ interface IPullAtomCallback {
    /**
    /**
     * Initiate a request for a pull for an atom.
     * Initiate a request for a pull for an atom.
     */
     */
     void onPullAtom(int atomTag, IPullAtomResultReceiver resultReceiver);
     oneway void onPullAtom(int atomTag, IPullAtomResultReceiver resultReceiver);


}
}
+3 −0
Original line number Original line Diff line number Diff line
@@ -90,4 +90,7 @@ interface IStatsCompanionService {
    /** Tells StatsCompanionService to tell statsd to register a puller for the given atom id */
    /** Tells StatsCompanionService to tell statsd to register a puller for the given atom id */
    oneway void registerPullAtomCallback(int atomTag, long coolDownNs, long timeoutNs,
    oneway void registerPullAtomCallback(int atomTag, long coolDownNs, long timeoutNs,
            in int[] additiveFields, IPullAtomCallback pullerCallback);
            in int[] additiveFields, IPullAtomCallback pullerCallback);

    /** Tells StatsCompanionService to tell statsd to unregister a puller for the given atom id */
    oneway void unregisterPullAtomCallback(int atomTag);
}
}
+5 −0
Original line number Original line Diff line number Diff line
@@ -215,6 +215,11 @@ interface IStatsd {
    */
    */
   oneway void unregisterPullerCallback(int atomTag, String packageName);
   oneway void unregisterPullerCallback(int atomTag, String packageName);


  /**
   * Unregisters any pullAtomCallback for the given uid/atom.
   */
   oneway void unregisterPullAtomCallback(int uid, int atomTag);

    /**
    /**
     * The install requires staging.
     * The install requires staging.
     */
     */
+24 −0
Original line number Original line Diff line number Diff line
@@ -2752,6 +2752,30 @@ public class StatsCompanionService extends IStatsCompanionService.Stub {
        }
        }
    }
    }


    @Override
    public void unregisterPullAtomCallback(int atomTag) {
        synchronized (sStatsdLock) {
            // Always remove the puller in SCS.
            // If statsd is down, we will not register it when it comes back up.
            int callingUid = Binder.getCallingUid();
            final long token = Binder.clearCallingIdentity();
            PullerKey key = new PullerKey(callingUid, atomTag);
            mPullers.remove(key);

            if (sStatsd == null) {
                Slog.w(TAG, "Could not access statsd for registering puller for atom " + atomTag);
                return;
            }
            try {
                sStatsd.unregisterPullAtomCallback(callingUid, atomTag);
            } catch (RemoteException e) {
                Slog.e(TAG, "Failed to access statsd to register puller for atom " + atomTag);
            } finally {
                Binder.restoreCallingIdentity(token);
            }
        }
    }

    // Statsd related code
    // Statsd related code


    /**
    /**
+7 −0
Original line number Original line Diff line number Diff line
@@ -1320,6 +1320,13 @@ Status StatsService::unregisterPullerCallback(int32_t atomTag, const String16& p
    return Status::ok();
    return Status::ok();
}
}


Status StatsService::unregisterPullAtomCallback(int32_t uid, int32_t atomTag) {
    ENFORCE_UID(AID_SYSTEM);
    VLOG("StatsService::unregisterPullAtomCallback called.");
    mPullerManager->UnregisterPullAtomCallback(uid, atomTag);
    return Status::ok();
}

Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainNameIn,
Status StatsService::sendBinaryPushStateChangedAtom(const android::String16& trainNameIn,
                                                    const int64_t trainVersionCodeIn,
                                                    const int64_t trainVersionCodeIn,
                                                    const int options,
                                                    const int options,
Loading