Loading include/binder/IProcessInfoService.h +0 −10 Original line number Original line Diff line number Diff line Loading @@ -44,16 +44,6 @@ public: // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- class BnProcessInfoService : public BnInterface<IProcessInfoService> { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------- }; // namespace android }; // namespace android #endif // ANDROID_I_PROCESS_INFO_SERVICE_H #endif // ANDROID_I_PROCESS_INFO_SERVICE_H libs/binder/IProcessInfoService.cpp +0 −68 Original line number Original line Diff line number Diff line Loading @@ -88,72 +88,4 @@ IMPLEMENT_META_INTERFACE(ProcessInfoService, "android.os.IProcessInfoService"); // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- status_t BnProcessInfoService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case GET_PROCESS_STATES_FROM_PIDS: { CHECK_INTERFACE(IProcessInfoService, data, reply); int32_t arrayLen = data.readInt32(); if (arrayLen <= 0) { reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(NOT_ENOUGH_DATA); return NO_ERROR; } size_t len = static_cast<size_t>(arrayLen); int32_t pids[len]; status_t res = data.read(pids, len * sizeof(*pids)); // Ignore output array length returned in the parcel here, as the states array must // always be the same length as the input PIDs array. int32_t states[len]; for (size_t i = 0; i < len; i++) states[i] = -1; if (res == NO_ERROR) { res = getProcessStatesFromPids(len, /*in*/ pids, /*out*/ states); } reply->writeNoException(); reply->writeInt32Array(len, states); reply->writeInt32(res); return NO_ERROR; } break; case GET_PROCESS_STATES_AND_OOM_SCORES_FROM_PIDS: { CHECK_INTERFACE(IProcessInfoService, data, reply); int32_t arrayLen = data.readInt32(); if (arrayLen <= 0) { reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(NOT_ENOUGH_DATA); return NO_ERROR; } size_t len = static_cast<size_t>(arrayLen); int32_t pids[len]; status_t res = data.read(pids, len * sizeof(*pids)); // Ignore output array length returned in the parcel here, as the // states array must always be the same length as the input PIDs array. int32_t states[len]; int32_t scores[len]; for (size_t i = 0; i < len; i++) { states[i] = -1; scores[i] = -10000; } if (res == NO_ERROR) { res = getProcessStatesAndOomScoresFromPids( len, /*in*/ pids, /*out*/ states, /*out*/ scores); } reply->writeNoException(); reply->writeInt32Array(len, states); reply->writeInt32Array(len, scores); reply->writeInt32(res); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------- }; // namespace android }; // namespace android Loading
include/binder/IProcessInfoService.h +0 −10 Original line number Original line Diff line number Diff line Loading @@ -44,16 +44,6 @@ public: // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- class BnProcessInfoService : public BnInterface<IProcessInfoService> { public: virtual status_t onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags = 0); }; // ---------------------------------------------------------------------- }; // namespace android }; // namespace android #endif // ANDROID_I_PROCESS_INFO_SERVICE_H #endif // ANDROID_I_PROCESS_INFO_SERVICE_H
libs/binder/IProcessInfoService.cpp +0 −68 Original line number Original line Diff line number Diff line Loading @@ -88,72 +88,4 @@ IMPLEMENT_META_INTERFACE(ProcessInfoService, "android.os.IProcessInfoService"); // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- status_t BnProcessInfoService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch(code) { case GET_PROCESS_STATES_FROM_PIDS: { CHECK_INTERFACE(IProcessInfoService, data, reply); int32_t arrayLen = data.readInt32(); if (arrayLen <= 0) { reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(NOT_ENOUGH_DATA); return NO_ERROR; } size_t len = static_cast<size_t>(arrayLen); int32_t pids[len]; status_t res = data.read(pids, len * sizeof(*pids)); // Ignore output array length returned in the parcel here, as the states array must // always be the same length as the input PIDs array. int32_t states[len]; for (size_t i = 0; i < len; i++) states[i] = -1; if (res == NO_ERROR) { res = getProcessStatesFromPids(len, /*in*/ pids, /*out*/ states); } reply->writeNoException(); reply->writeInt32Array(len, states); reply->writeInt32(res); return NO_ERROR; } break; case GET_PROCESS_STATES_AND_OOM_SCORES_FROM_PIDS: { CHECK_INTERFACE(IProcessInfoService, data, reply); int32_t arrayLen = data.readInt32(); if (arrayLen <= 0) { reply->writeNoException(); reply->writeInt32(0); reply->writeInt32(NOT_ENOUGH_DATA); return NO_ERROR; } size_t len = static_cast<size_t>(arrayLen); int32_t pids[len]; status_t res = data.read(pids, len * sizeof(*pids)); // Ignore output array length returned in the parcel here, as the // states array must always be the same length as the input PIDs array. int32_t states[len]; int32_t scores[len]; for (size_t i = 0; i < len; i++) { states[i] = -1; scores[i] = -10000; } if (res == NO_ERROR) { res = getProcessStatesAndOomScoresFromPids( len, /*in*/ pids, /*out*/ states, /*out*/ scores); } reply->writeNoException(); reply->writeInt32Array(len, states); reply->writeInt32Array(len, scores); reply->writeInt32(res); return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } } // ---------------------------------------------------------------------- }; // namespace android }; // namespace android